diff --git a/parser-typechecker/src/Unison/KindInference/Generate.hs b/parser-typechecker/src/Unison/KindInference/Generate.hs index ab675534d2..3ed3361f37 100644 --- a/parser-typechecker/src/Unison/KindInference/Generate.hs +++ b/parser-typechecker/src/Unison/KindInference/Generate.hs @@ -101,7 +101,7 @@ typeConstraintTree resultVar term@ABT.Term {annotation, out} = do restConstraints <- typeConstraintTree resultVar b pure $ Node [effConstraints, restConstraints] Type.Effects effs -> do - Node <$> for effs \eff -> do + ParentConstraint (IsAbility resultVar (Provenance EffectsList annotation)) . Node <$> for effs \eff -> do effKind <- freshVar eff effConstraints <- typeConstraintTree effKind eff pure $ ParentConstraint (IsAbility effKind (Provenance EffectsList $ ABT.annotation eff)) effConstraints diff --git a/unison-src/tests/type-application.u b/unison-src/tests/type-application.u index 87b673809d..345bcc2aee 100644 --- a/unison-src/tests/type-application.u +++ b/unison-src/tests/type-application.u @@ -3,6 +3,7 @@ structural ability Foo where foo : {Foo} Nat structural type Wrap a = Wrap Nat +structural type C = C (Wrap {}) -- constrain Wrap kind blah : Wrap {Foo} -> Nat blah = cases diff --git a/unison-src/transcripts/fix3196.md b/unison-src/transcripts/fix3196.md index 46755570e5..65d0dbf8a0 100644 --- a/unison-src/transcripts/fix3196.md +++ b/unison-src/transcripts/fix3196.md @@ -15,6 +15,9 @@ structural type W es = W unique ability Zoot where zoot : () +-- here only to put a kind constraint on W +structural type C = C (W {}) + woot : W {g} -> '{g, Zoot} a ->{Zoot} a woot w a = todo () diff --git a/unison-src/transcripts/fix3196.output.md b/unison-src/transcripts/fix3196.output.md index 3b8f046472..e9811bdbef 100644 --- a/unison-src/transcripts/fix3196.output.md +++ b/unison-src/transcripts/fix3196.output.md @@ -10,6 +10,9 @@ structural type W es = W unique ability Zoot where zoot : () +-- here only to put a kind constraint on W +structural type C = C (W {}) + woot : W {g} -> '{g, Zoot} a ->{Zoot} a woot w a = todo () @@ -36,6 +39,7 @@ w2 = cases W -> W ⍟ These new definitions are ok to `add`: + structural type C structural type W es ability Zoot ex : '{Zoot} r @@ -46,7 +50,7 @@ w2 = cases W -> W Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels. - 19 | > w2 w1 + 22 | > w2 w1 ⧩ W