瀏覽代碼

restore a check for function args of type Void (fixes #6201)

Aleksandr Kuzmenko 6 年之前
父節點
當前提交
1d924317a8

+ 3 - 0
src/typing/typeloadFunction.ml

@@ -29,6 +29,9 @@ open Common
 open Error
 
 let type_function_arg ctx t e opt p =
+	(match follow t with
+		| TAbstract ({a_path = [],"Void"},_) -> error "Arguments of type Void are not allowed" p
+		| _ -> ());
 	if opt then
 		let e = (match e with None -> Some (EConst (Ident "null"),null_pos) | _ -> e) in
 		ctx.t.tnull t, e

+ 5 - 0
tests/misc/projects/Issue6201/Main.hx

@@ -0,0 +1,5 @@
+class Main {
+	static function method(param:Void = null) {}
+
+	public static function main() {}
+}

+ 1 - 0
tests/misc/projects/Issue6201/compile-fail.hxml

@@ -0,0 +1 @@
+-main Main

+ 1 - 0
tests/misc/projects/Issue6201/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:2: characters 25-30 : Arguments of type Void are not allowed