Pārlūkot izejas kodu

changed s_type to emit "Abstract<Foo>" instead of "Class<_Foo_Impl_>"
#8819

Aleksandr Kuzmenko 5 gadi atpakaļ
vecāks
revīzija
bdf2e56c27

+ 0 - 2
src/core/error.ml

@@ -35,8 +35,6 @@ let short_type ctx t =
 	if String.length tstr > 150 then String.sub tstr 0 147 ^ "..." else tstr
 
 let unify_error_msg ctx err = match err with
-	| Cannot_unify (TType({ t_type = TAnon { a_status = { contents = Statics { cl_kind = KAbstractImpl _ }}}}, _),_) ->
-		"Cannot use abstract as value"
 	| Cannot_unify (t1,t2) ->
 		s_type ctx t1 ^ " should be " ^ s_type ctx t2
 	| Invalid_field_type s ->

+ 2 - 0
src/core/tPrinting.ml

@@ -48,6 +48,8 @@ let rec s_type ctx t =
 		(match c.cl_kind with
 		| KExpr e -> Ast.Printer.s_expr e
 		| _ -> s_type_path c.cl_path ^ s_type_params ctx tl)
+	| TType ({ t_type = TAnon { a_status = { contents = Statics { cl_kind = KAbstractImpl a }}}}, _) ->
+		"Abstract<" ^ (s_type_path a.a_path) ^ ">"
 	| TType (t,tl) ->
 		s_type_path t.t_path ^ s_type_params ctx tl
 	| TAbstract (a,tl) ->

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

@@ -1,4 +1,4 @@
 Main.hx:16: characters 9-29 : Class<C> should be { member : Int }
 Main.hx:16: characters 9-29 : The field member is not public
-Main.hx:17: characters 9-29 : Cannot use abstract as value
+Main.hx:17: characters 9-29 : Abstract<A> should be { member : Int }
 Main.hx:17: characters 9-29 : The field member is not public

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

@@ -1,2 +1,2 @@
-Main.hx:3: characters 17-20 : Cannot use abstract as value
+Main.hx:3: characters 17-20 : Abstract<Foo> should be Enum<Unknown<0>>
 Main.hx:3: characters 17-20 : For function argument 'e'