on master help sign in
Update changelog and error messages for type aliases in port types
commit52ecd6ba10b3aa0c1b648e23ec7554042915ea87 authorEvan Czaplicki <info@elm-lang.org> dateFri 13 Jun 2014, 12:27 (12 years ago) parent7e101d3
2 files changed+4−9
changelog.md+1 compiler/Type/ExtraChecks.hs+3−9
changelog.md+1
@@ -3,6 +3,7 @@
33
44#### Improvements:
55
6+ * Type aliases are allowed in port types
67 * Error on ambiguious use of imported variables
78 * Higher kinded polymorphism (a.k.a. higher-order types)
89 * Many bug fixes for importing types
compiler/Type/ExtraChecks.hs+3−9
@@ -65,7 +65,7 @@ portTypes expr =
6565 ST.Type v
6666 | V.isJson v -> return ()
6767 | V.isPrimitive v -> return ()
68− | otherwise -> err' True "an unsupported type"
68+ | otherwise -> err "an unsupported type"
6969
7070 ST.App t [] -> valid t
7171
@@ -78,7 +78,7 @@ portTypes expr =
7878 ST.App (ST.Type v) ts
7979 | V.isTuple v -> mapM_ valid ts
8080
81− ST.App _ _ -> err' True "an unsupported type"
81+ ST.App _ _ -> err "an unsupported type"
8282
8383 ST.Var _ -> err "free type variables"
8484
@@ -109,8 +109,7 @@ portTypes expr =
109109 dir inMsg outMsg = case direction of { In -> inMsg ; Out -> outMsg }
110110 txt = P.text . concat
111111
112− err = err' False
113− err' couldBeAlias kind =
112+ err kind =
114113 throw $
115114 [ txt [ "Type Error: the value ", dir "coming in" "sent out"
116115 , " through port '", name, "' is invalid." ]
@@ -119,11 +118,6 @@ portTypes expr =
119118 , txt [ "Acceptable values for ", dir "incoming" "outgoing", " ports include:" ]
120119 , txt [ " Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples," ]
121120 , txt [ " Json.Values, ", dir "" "first-order functions, ", "and concrete records." ]
122− ] ++ if couldBeAlias then aliasWarning else []
123−
124− aliasWarning =
125− [ txt [ "\nType aliases are not expanded for this check (yet) so you need to do that" ]
126− , txt [ "manually for now (e.g. {x:Int,y:Int} instead of a type alias of that type)." ]
127121 ]
128122
129123occurs :: (String, TT.Variable) -> StateT TS.SolverState IO ()