on master help sign in
Properly recognize supers during unification
commitbd2ab8284524b1f30083fe897c2536ebea3c7af4 authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 21 Feb 2018, 10:40 (9 years ago) parentca2be8a
1 file changed+8−1
src/Type/Solve.hs+8−1
src/Type/Solve.hs+8−1
@@ -501,8 +501,15 @@ unit1 =
501501srcTypeToVariable :: Int -> Pools -> Map.Map N.Name () -> Can.Type -> IO Variable
502502srcTypeToVariable rank pools freeVars srcType =
503503 let
504+ nameToContent name
505+ | N.startsWith "number" name = FlexSuper Number (Just name)
506+ | N.startsWith "comparable" name = FlexSuper Comparable (Just name)
507+ | N.startsWith "appendable" name = FlexSuper Appendable (Just name)
508+ | N.startsWith "compappend" name = FlexSuper CompAppend (Just name)
509+ | otherwise = FlexVar (Just name)
510+
504511 makeVar name _ =
505− UF.fresh (Descriptor (FlexVar (Just name)) rank noMark Nothing)
512+ UF.fresh (Descriptor (nameToContent name) rank noMark Nothing)
506513 in
507514 do flexVars <- Map.traverseWithKey makeVar freeVars
508515 MVector.modify pools (Map.elems flexVars ++) rank