mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-13 09:55:35 +03:00
131 failures - fix bug in Term.freeTypeVars
that was causing some tests to fail
This commit is contained in:
parent
c306cdcd80
commit
740cc7e570
@ -174,6 +174,7 @@ bindSomeNames
|
||||
-- || traceShow ns False
|
||||
-- || trace "Free type vars:" False
|
||||
-- || traceShow (freeTypeVars e) False
|
||||
-- || traceShow e False
|
||||
-- = undefined
|
||||
bindSomeNames ns e = bindNames keepFree ns e where
|
||||
keepFree = Set.difference (freeVars e)
|
||||
@ -296,11 +297,10 @@ freeTypeVarAnnotations :: Ord vt => AnnotatedTerm' vt v a -> Map vt [a]
|
||||
freeTypeVarAnnotations e = multimap $ go Set.empty e where
|
||||
go bound tm = case tm of
|
||||
Var' _ -> mempty
|
||||
Ann' e (Type.stripIntroOuters -> t1) -> case t1 of
|
||||
Type.ForallsNamed' vs _ ->
|
||||
let bound' = bound <> Set.fromList vs
|
||||
in go bound' e <> ABT.freeVarOccurrences bound t1
|
||||
t1 -> ABT.freeVarOccurrences bound t1
|
||||
Ann' e (Type.stripIntroOuters -> t1) -> let
|
||||
bound' = case t1 of Type.ForallsNamed' vs _ -> bound <> Set.fromList vs
|
||||
_ -> bound
|
||||
in go bound' e <> ABT.freeVarOccurrences bound t1
|
||||
ABT.Tm' f -> foldMap (go bound) f
|
||||
(ABT.out -> ABT.Abs _ body) -> go bound body
|
||||
(ABT.out -> ABT.Cycle body) -> go bound body
|
||||
|
@ -2,14 +2,15 @@
|
||||
ability IO where
|
||||
launchMissiles : {IO} ()
|
||||
|
||||
foo : () -> {IO} ()
|
||||
foo : Int -> {IO} Int
|
||||
foo unit =
|
||||
incBy : Int -> {IO, State Int} ()
|
||||
incBy : Int -> {IO, State Int} Int
|
||||
incBy i =
|
||||
IO.launchMissiles -- OK, since declared by `incBy` signature
|
||||
y = State.get
|
||||
State.put (y Int.+ i)
|
||||
()
|
||||
+42
|
||||
+43
|
||||
|
||||
type Optional a =
|
||||
Some a | None
|
||||
|
Loading…
Reference in New Issue
Block a user