Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible happened when combining # and ! #332

Open
gteege opened this issue Dec 28, 2019 · 1 comment
Open

Impossible happened when combining # and ! #332

gteege opened this issue Dec 28, 2019 · 1 comment

Comments

@gteege
Copy link
Contributor

gteege commented Dec 28, 2019

The code

type T a = { x: #a }!
g: all(a). () -> T a

type S = { y : { z: U8 } }

f: () -> T S
f () = g[S] ()

causes the error message

Parsing...
Resolving dependencies...
Typechecking...
Desugaring and typing...
cogent: bound: not comparable: (TRecord [("z",(TPrim U8,False))] (Boxed False (Bits {allocSize = 0, allocOffset = 0})),TRecord [("z",(TPrim U8,False))] (Boxed True (Bits {allocSize = 0, allocOffset = 0}))): the 'impossible' happened!
If you see this, please report this bug to
    <https://github.com/NICTA/cogent/issues>

CallStack (from HasCallStack):
  error, called at src/Cogent/Compiler.hs:31:20 in cogent-2.9.0.0-MRVlC24fphLGNkexARYpV:Cogent.Compiler

It seems to me that the ! operator is not correctly propagated through the unbox operator.

@zilinc
Copy link

zilinc commented Jan 2, 2020

Depends on the fix to #306 . Right now because we haven't quite decided yet how to deal with !-ed and #-ed type vars, we don't have a syntax in the core language for such a thing. As a result the compiler simply (wrongly) desugars that #a! to a TVarUnboxed, resulting the mismatch of types in the core tc (https://github.com/NICTA/cogent/blob/master/cogent/src/Cogent/Desugar.hs#L524).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants