Răsfoiți Sursa

[typer] don't show everyone our massive decls

closes #9584
Simon Krajewski 4 ani în urmă
părinte
comite
64e7450622

+ 1 - 1
src/typing/typer.ml

@@ -1325,7 +1325,7 @@ and type_array_decl ctx el with_type p =
 	| Some t ->
 		let el = List.map (fun e ->
 			let e = type_expr ctx e (WithType.with_type t) in
-			AbstractCast.cast_or_unify ctx t e p;
+			AbstractCast.cast_or_unify ctx t e e.epos;
 		) el in
 		mk (TArrayDecl el) (ctx.t.tarray t) p)
 

+ 8 - 0
tests/misc/projects/Issue9584/Main.hx

@@ -0,0 +1,8 @@
+class Main {
+	static function main() {
+		final foo:Array<{x:Int, y:Int}> = [
+			{x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1},
+			{x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0, y: 1}, {x: 0,}
+		];
+	}
+}

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

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

+ 3 - 0
tests/misc/projects/Issue9584/compile-fail.hxml.stderr

@@ -0,0 +1,3 @@
+Main.hx:5: characters 74-81 : Object requires field y
+Main.hx:5: characters 74-81 : { x : Int } should be { y : Int, x : Int }
+Main.hx:5: characters 74-81 : ... { x : Int } has no field y