on master help sign in
Preserve type variable names from ports
commit074467f84da0a7b4e21ffaffc80eb591cd018013 authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 2 Apr 2018, 14:43 (9 years ago) parentc368061
1 file changed+3−3
compiler/src/Type/Constrain/Module.hs+3−3
compiler/src/Type/Constrain/Module.hs+3−3
@@ -16,7 +16,7 @@ import qualified Reporting.Error.Type as E
1616import qualified Reporting.Region as R
1717import qualified Type.Constrain.Expression as Expr
1818import qualified Type.Instantiate as Instantiate
19−import Type.Type (Type(..), Constraint(..), (==>), mkFlexVar, never)
19+import Type.Type (Type(..), Constraint(..), (==>), mkFlexVar, nameToRigid, never)
2020
2121
2222
@@ -73,13 +73,13 @@ letPort :: N.Name -> Can.Port -> IO Constraint -> IO Constraint
7373letPort name port_ makeConstraint =
7474 case port_ of
7575 Can.Incoming freeVars _ srcType ->
76− do vars <- traverse (\_ -> mkFlexVar) freeVars
76+ do vars <- Map.traverseWithKey (\k _ -> nameToRigid k) freeVars
7777 tipe <- Instantiate.fromSrcType (Map.map VarN vars) srcType
7878 let header = Map.singleton name (A.At R.zero tipe)
7979 CLet (Map.elems vars) [] header CTrue <$> makeConstraint
8080
8181 Can.Outgoing freeVars _ srcType ->
82− do vars <- traverse (\_ -> mkFlexVar) freeVars
82+ do vars <- Map.traverseWithKey (\k _ -> nameToRigid k) freeVars
8383 tipe <- Instantiate.fromSrcType (Map.map VarN vars) srcType
8484 let header = Map.singleton name (A.At R.zero tipe)
8585 CLet (Map.elems vars) [] header CTrue <$> makeConstraint