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

"bound at" information isn't very precise. #36

Closed
zilinc opened this issue Nov 21, 2016 · 11 comments
Closed

"bound at" information isn't very precise. #36

zilinc opened this issue Nov 21, 2016 · 11 comments

Comments

@zilinc
Copy link

zilinc commented Nov 21, 2016

This program doesn't look correct but typechecks:

foo : all a. (a, a!) -> a

type A

bar : (A, A) -> A
bar (a,a') = let a'' = foo (a, a') !a'
              in a''
@liamoc
Copy link
Collaborator

liamoc commented Nov 21, 2016

Why isn't it correct?

Edit: Ah, I suppose you should be required to use a'.. wonder why that happened...

zilinc pushed a commit that referenced this issue Nov 21, 2016
ajaysusarla pushed a commit to ajaysusarla/cogent that referenced this issue Nov 22, 2016
@zilinc
Copy link
Author

zilinc commented Nov 23, 2016

Something very wrong... even code like

type A
foo : A -> ()
foo a = ()

will pass.

zilinc pushed a commit that referenced this issue Nov 23, 2016
@zilinc zilinc changed the title linearity checking linear types can be discarded Nov 23, 2016
@liamoc
Copy link
Collaborator

liamoc commented Nov 23, 2016

It's a simple bug. I just forgot to emit Drop constraints when stuff goes out of scope.

liamoc added a commit to liamoc/cogent that referenced this issue Nov 23, 2016
@liamoc
Copy link
Collaborator

liamoc commented Nov 23, 2016

Fixed.

@zilinc
Copy link
Author

zilinc commented Nov 23, 2016

fail_ticket-e36.cogent still passes

@liamoc
Copy link
Collaborator

liamoc commented Nov 23, 2016

No, it gives this for me:

./tests/fail_ticket-e36.cogent
Parsing...
Resolving dependencies...
Typechecking...
Cannot discard type A but this is needed as the variable a' bound at "././tests/fail_ticket-e36.cogent" (line 5, column 1)
was never used.
   from constraint Drop A
   in the 1st alternative (a, a')
   in the definition at ("././tests/fail_ticket-e36.cogent" (line 5, column 1))
   for the function bar
Compilation failed!

@zilinc
Copy link
Author

zilinc commented Nov 23, 2016

Indeed.. don't know why it didn't install to the right place..

@zilinc
Copy link
Author

zilinc commented Nov 23, 2016

the first location isn't good.

@liamoc
Copy link
Collaborator

liamoc commented Nov 23, 2016

First location?

@zilinc
Copy link
Author

zilinc commented Nov 23, 2016

this one ---> bound at "././tests/fail_ticket-e36.cogent" (line 5, column 1)

@liamoc
Copy link
Collaborator

liamoc commented Nov 23, 2016

Yeah unfortunately the locations aren't very precise in the column... patterns don't carry location information IIRC. I might be able to fix that at some point but it means reworking the AST a bit.

@zilinc zilinc added enhancement and removed bug labels Nov 23, 2016
@liamoc liamoc changed the title linear types can be discarded "bound at" information isn't very precise. Nov 26, 2016
ajaysusarla pushed a commit that referenced this issue Nov 28, 2016
ajaysusarla pushed a commit that referenced this issue Nov 28, 2016
zilinc pushed a commit that referenced this issue Dec 22, 2016
This solves #36.

FIXME:
* Lots of locations are still not accurate, esp. in desugarer;
* Pattern context might not be good enough (or not added properly);
@zilinc zilinc closed this as completed Dec 22, 2016
zilinc pushed a commit that referenced this issue Jan 12, 2017
zilinc pushed a commit that referenced this issue Jan 12, 2017
zilinc pushed a commit that referenced this issue Jan 12, 2017
zilinc pushed a commit that referenced this issue Jan 12, 2017
zilinc pushed a commit that referenced this issue Jan 12, 2017
This solves #36.

FIXME:
* Lots of locations are still not accurate, esp. in desugarer;
* Pattern context might not be good enough (or not added properly);
zilinc pushed a commit that referenced this issue Jan 11, 2018
zilinc pushed a commit that referenced this issue Jan 11, 2018
zilinc pushed a commit that referenced this issue Jan 11, 2018
zilinc pushed a commit that referenced this issue Jan 11, 2018
zilinc pushed a commit that referenced this issue Jan 11, 2018
This solves #36.

FIXME:
* Lots of locations are still not accurate, esp. in desugarer;
* Pattern context might not be good enough (or not added properly);
zilinc pushed a commit that referenced this issue Jan 22, 2018
zilinc pushed a commit that referenced this issue Jan 22, 2018
zilinc pushed a commit that referenced this issue Jan 22, 2018
zilinc pushed a commit that referenced this issue Jan 22, 2018
zilinc pushed a commit that referenced this issue Jan 22, 2018
This solves #36.

FIXME:
* Lots of locations are still not accurate, esp. in desugarer;
* Pattern context might not be good enough (or not added properly);
zilinc pushed a commit that referenced this issue Mar 6, 2018
zilinc pushed a commit that referenced this issue Mar 6, 2018
zilinc pushed a commit that referenced this issue Mar 6, 2018
zilinc pushed a commit that referenced this issue Mar 6, 2018
zilinc pushed a commit that referenced this issue Mar 6, 2018
This solves #36.

FIXME:
* Lots of locations are still not accurate, esp. in desugarer;
* Pattern context might not be good enough (or not added properly);
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