on master help sign in
Use new Located datastructure, add source strings where appropriate
commit51bc878b5169aec58926e7892521df73df765dde authorEvan Czaplicki <info@elm-lang.org> dateSat 3 Aug 2013, 11:41 (13 years ago) parent177a037
5 files changed+10−8
compiler/Type/Constrain/Expression.hs+1−1 compiler/Type/Constrain/Pattern.hs+3−1 compiler/Type/Fragment.hs+2−2 compiler/Type/Inference.hs+2−2 compiler/Type/Type.hs+2−2
compiler/Type/Constrain/Expression.hs+1−1
@@ -160,7 +160,7 @@ constrainDef env info (pattern, expr, maybeTipe) =
160160 (vars, typ) <- Env.instantiateType env tipe Map.empty
161161 let scheme = Scheme { rigidQuantifiers = [],
162162 flexibleQuantifiers = flexiVars ++ vars,
163− constraint = Loc.none CTrue,
163+ constraint = Loc.noneNoDocs CTrue,
164164 header = Map.singleton name typ }
165165 c <- constrain env' expr typ
166166 return ( scheme : schemes
compiler/Type/Constrain/Pattern.hs+3−1
@@ -8,6 +8,8 @@ import qualified Data.Maybe as Maybe
88import qualified Data.Map as Map
99
1010import SourceSyntax.Pattern
11+import SourceSyntax.PrettyPrint
12+import Text.PrettyPrint (render)
1113import qualified SourceSyntax.Location as Loc
1214import Type.Type
1315import Type.Fragment
@@ -17,7 +19,7 @@ import qualified Type.Constrain.Literal as Literal
1719
1820constrain :: Environment -> Pattern -> Type -> IO Fragment
1921constrain env pattern tipe =
20− let span = Loc.NoSpan
22+ let span = Loc.NoSpan (render $ pretty pattern)
2123 t1 === t2 = Loc.L span (CEqual t1 t2)
2224 x <? t = Loc.L span (CInstance x t)
2325 in
compiler/Type/Fragment.hs+2−2
@@ -5,7 +5,7 @@ import qualified Data.Map as Map
55
66import Type.Type
77import SourceSyntax.Pattern
8−import SourceSyntax.Location (none)
8+import SourceSyntax.Location (noneNoDocs)
99
1010data Fragment = Fragment {
1111 typeEnv :: Map.Map String Type,
@@ -13,7 +13,7 @@ data Fragment = Fragment {
1313 typeConstraint :: TypeConstraint
1414} deriving Show
1515
16−emptyFragment = Fragment Map.empty [] (none CTrue)
16+emptyFragment = Fragment Map.empty [] (noneNoDocs CTrue)
1717
1818joinFragment f1 f2 = Fragment {
1919 typeEnv = Map.union (typeEnv f1) (typeEnv f2),
compiler/Type/Inference.hs+2−2
@@ -10,7 +10,7 @@ import qualified Type.Solve as Solve
1010
1111import SourceSyntax.Module as Module
1212import qualified SourceSyntax.Expression as Expr
13−import SourceSyntax.Location (none)
13+import SourceSyntax.Location (Located, noneNoDocs)
1414import SourceSyntax.PrettyPrint
1515import Text.PrettyPrint
1616import qualified Type.State as TS
@@ -38,7 +38,7 @@ infer interfaces modul = unsafePerformIO $ do
3838 let allTypes = ctors ++ importedVars
3939 vars = concatMap (fst . snd) allTypes
4040 header = Map.map snd (Map.fromList allTypes)
41− environ = none . T.CLet [ T.Scheme vars [] (none T.CTrue) header ]
41+ environ = noneNoDocs . T.CLet [ T.Scheme vars [] (noneNoDocs T.CTrue) header ]
4242
4343 fvar <- T.var T.Flexible
4444 constraint <- environ `fmap` TcExpr.constrain env (program modul) (T.VarN fvar)
compiler/Type/Type.hs+2−2
@@ -56,7 +56,7 @@ data Scheme a b = Scheme {
5656type TypeConstraint = Constraint Type Variable
5757type TypeScheme = Scheme Type Variable
5858
59−monoscheme headers = Scheme [] [] (none CTrue) headers
59+monoscheme headers = Scheme [] [] (noneNoDocs CTrue) headers
6060
6161infixl 8 /\
6262
@@ -65,7 +65,7 @@ a@(L s1 c1) /\ b@(L s2 c2) =
6565 case (c1, c2) of
6666 (CTrue, _) -> b
6767 (_, CTrue) -> a
68− _ -> merge a b (CAnd [a,b])
68+ _ -> mergeOldDocs a b (CAnd [a,b])
6969
7070infixr 9 ==>
7171(==>) :: Type -> Type -> Type