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

Compiler crash when using an alias to a record constructor #2664

Closed
paulcadman opened this issue Feb 21, 2024 · 0 comments · Fixed by #2669
Closed

Compiler crash when using an alias to a record constructor #2664

paulcadman opened this issue Feb 21, 2024 · 0 comments · Fixed by #2669

Comments

@paulcadman
Copy link
Collaborator

See https://github.com/anoma/juvix/tree/alias-record-constructor-bug for a failing test.

module AliasRecordConstructor;

type A := a;

type T := mkT {field : A};

syntax alias mkT' := mkT;

t : T :=
  mkT'@{
    field := a
  };

juvix typecheck on the above file causes:

juvix: Maybe.fromJust: Nothing
CallStack (from HasCallStack):
  error, called at libraries/base/Data/Maybe.hs:150:21 in base:Data.Maybe
  fromJust, called at src/Juvix/Compiler/Internal/Translation/FromConcrete.hs:761:16 in juvix-0.5.5-86FKWMdO6cV1eCQIhkrrGY:Juvix.Compiler.Internal.Translation.FromConcrete
paulcadman added a commit that referenced this issue Feb 26, 2024
#2669)

* Closes #2664

As well as this fix we rename lens scopedIdenName to scopedIdenSrcName.
`scopedIdenSrcName` refers to the name of an identifier from the source
code. The name `scopedIdenName` is confusing because users of
`ScopedIden` may think that this lens refers to the only name associated
with `ScopedIden`, they may want `scopedIdenNameFinal` instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants