diff --git a/src/typing/typeload.ml b/src/typing/typeload.ml index c59330fc8f5..cc3ec45e541 100644 --- a/src/typing/typeload.ml +++ b/src/typing/typeload.ml @@ -755,15 +755,16 @@ and type_type_params ctx host path p tpl = let r = make_lazy ctx.g ttp.ttp_type (fun r -> let t = load_complex_type ctx true LoadNormal ct in begin match host with - | TPHType -> - () - | TPHConstructor - | TPHMethod - | TPHEnumConstructor - | TPHAnonField - | TPHLocal -> - display_error ctx.com "Default type parameters are only supported on types" (pos ct) + | TPHType -> + () + | TPHConstructor + | TPHMethod + | TPHEnumConstructor + | TPHAnonField + | TPHLocal -> + display_error ctx.com "Default type parameters are only supported on types" (pos ct) end; + check_param_constraints ctx t (fun t -> t) ttp (pos ct); t ) "default" in ttp.ttp_default <- Some (TLazy r) diff --git a/tests/misc/projects/Issue11556/Main.hx b/tests/misc/projects/Issue11556/Main.hx new file mode 100644 index 00000000000..6314d459ad2 --- /dev/null +++ b/tests/misc/projects/Issue11556/Main.hx @@ -0,0 +1,7 @@ +class Foo { + public var data:T; + + public final function new() {} +} + +function main() {} diff --git a/tests/misc/projects/Issue11556/compile-fail.hxml b/tests/misc/projects/Issue11556/compile-fail.hxml new file mode 100644 index 00000000000..41d73305850 --- /dev/null +++ b/tests/misc/projects/Issue11556/compile-fail.hxml @@ -0,0 +1,3 @@ +--main Main +-neko neko.n +--no-output \ No newline at end of file diff --git a/tests/misc/projects/Issue11556/compile-fail.hxml.stderr b/tests/misc/projects/Issue11556/compile-fail.hxml.stderr new file mode 100644 index 00000000000..3a4b41a891d --- /dev/null +++ b/tests/misc/projects/Issue11556/compile-fail.hxml.stderr @@ -0,0 +1,2 @@ +Main.hx:1: characters 25-29 : Constraint check failure for Foo.T +Main.hx:1: characters 25-29 : ... Void should be EnumValue \ No newline at end of file