Skip to content

Commit 3202e61

Browse files
authored
Merge pull request #5300 from unisonweb/travis/kind-inference-fix
Fixes #5293: Generate IsAbility constraint for ability sets
2 parents 4284b1d + 6c9495c commit 3202e61

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

parser-typechecker/src/Unison/KindInference/Generate.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ typeConstraintTree resultVar [email protected] {annotation, out} = do
101101
restConstraints <- typeConstraintTree resultVar b
102102
pure $ Node [effConstraints, restConstraints]
103103
Type.Effects effs -> do
104-
Node <$> for effs \eff -> do
104+
ParentConstraint (IsAbility resultVar (Provenance EffectsList annotation)) . Node <$> for effs \eff -> do
105105
effKind <- freshVar eff
106106
effConstraints <- typeConstraintTree effKind eff
107107
pure $ ParentConstraint (IsAbility effKind (Provenance EffectsList $ ABT.annotation eff)) effConstraints

unison-src/tests/type-application.u

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ structural ability Foo where
33
foo : {Foo} Nat
44

55
structural type Wrap a = Wrap Nat
6+
structural type C = C (Wrap {}) -- constrain Wrap kind
67

78
blah : Wrap {Foo} -> Nat
89
blah = cases

unison-src/transcripts/fix3196.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ structural type W es = W
1515
unique ability Zoot where
1616
zoot : ()
1717
18+
-- here only to put a kind constraint on W
19+
structural type C = C (W {})
20+
1821
woot : W {g} -> '{g, Zoot} a ->{Zoot} a
1922
woot w a = todo ()
2023

unison-src/transcripts/fix3196.output.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ structural type W es = W
1010
unique ability Zoot where
1111
zoot : ()
1212
13+
-- here only to put a kind constraint on W
14+
structural type C = C (W {})
15+
1316
woot : W {g} -> '{g, Zoot} a ->{Zoot} a
1417
woot w a = todo ()
1518
@@ -36,6 +39,7 @@ w2 = cases W -> W
3639
3740
⍟ These new definitions are ok to `add`:
3841
42+
structural type C
3943
structural type W es
4044
ability Zoot
4145
ex : '{Zoot} r
@@ -46,7 +50,7 @@ w2 = cases W -> W
4650
Now evaluating any watch expressions (lines starting with
4751
`>`)... Ctrl+C cancels.
4852
49-
19 | > w2 w1
53+
22 | > w2 w1
5054
5155
W
5256

0 commit comments

Comments
 (0)