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

Variable of unboxed abstract type is treated as linear. #309

Open
gteege opened this issue Nov 6, 2019 · 3 comments
Open

Variable of unboxed abstract type is treated as linear. #309

gteege opened this issue Nov 6, 2019 · 3 comments

Comments

@gteege
Copy link
Contributor

gteege commented Nov 6, 2019

type A
type B a

f : #(B A)  -> ()
f b = ()

causes the error message:

Parsing...
Resolving dependencies...
Typechecking...
Desugaring and typing...
Internal TC failed: Didn't use linear variable
Compilation failed!

If A is not abstract (replaced by U32) it works.

@zilinc zilinc closed this as completed in 91101fc Nov 7, 2019
@zilinc zilinc reopened this Nov 7, 2019
@zilinc
Copy link

zilinc commented Nov 7, 2019

Need to check if the Isabelle side agrees with the compiler.

@zilinc
Copy link

zilinc commented Nov 8, 2019

91101fc doesn't match the Isabelle spec. In the spec when it checks the kind of TCon tn ts s, it looks at both ts and the sigil s, whereas in the surface TC it only looks at the sigil. Core TC (before 91101fc) was actually correct w.r.t the spec.

@zilinc
Copy link

zilinc commented Nov 8, 2019

#T can either mean a stack object which contains pointers to the heap, or a purely stack allocated object. From the type we can't tell them apart. But their linearity properties are quite different: the former is linear, and the latter is non-linear. According to the Isabelle semantics, #T seems to mean the latter, but #(T A) means the former, which means that to express the former case, you are forced to parameterise the abstract type with something, but you can instantiate the type var with any linear type.

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