on master help sign in
Tag mismatches between ints and floats
8ad4c70Evan Czaplicki
src/Type/Unify.hs+10−1
@@ -453,7 +453,11 @@ unifyAtom context name otherContent =
453 merge context otherContent
453 merge context otherContent
454
454
455 else
455 else
456− mismatch context Nothing
456+ mismatch context $
457+ if isIntFloat name otherName || isIntFloat otherName name then
458+ Just Error.IntFloat
459+ else
460+ Nothing
457
461
458 Alias _ _ realVar ->
462 Alias _ _ realVar ->
459 subUnify context (_first context) realVar
463 subUnify context (_first context) realVar
@@ -462,9 +466,14 @@ unifyAtom context name otherContent =
462 mismatch context Nothing
466 mismatch context Nothing
463
467
464
468
469+isIntFloat :: Var.Canonical -> Var.Canonical -> Bool
470+isIntFloat name otherName =
471+ Var.isPrim "Int" name && Var.isPrim "Float" otherName
472+
465
473
466-- UNIFY ALIASES
474-- UNIFY ALIASES
467
475
476+
468unifyAlias :: Context -> Var.Canonical -> [(String, Variable)] -> Variable -> Content -> Unify ()
477unifyAlias :: Context -> Var.Canonical -> [(String, Variable)] -> Variable -> Content -> Unify ()
469unifyAlias context name args realVar otherContent =
478unifyAlias context name args realVar otherContent =
470 case otherContent of
479 case otherContent of