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

Store syntax aliases in serialized scoper infotable #2605

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

paulcadman
Copy link
Collaborator

This PR fixes an issue with importing syntax alias and using them from another module:

Say you have a module defining a syntax alias:

module SyntaxAlias;

import Stdlib.Prelude open;

syntax alias MyNat := Nat;

and another which imports / uses it:

module test073;

import SyntaxAlias open;

main : MyNat := 11;

The compiler crashed with the following error:

^?!): empty Fold
            CallStack (from HasCallStack):
              error, called at src/Lens/Micro.hs:711:28 in microlens-0.4.13.1-ARwI8t2x86cAxRs56XPcG1:Lens.Micro
              ^?!, called at src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs:565:29 in juvix-0.5.5-G7jC6MbkbsJGkMT9u4BkYQ:Juvix.Compiler.Concrete.Translation.FromParsed.Analysis.Scoping

We fix this by adding the aliases to the store's scoper info table and then use it to initialise the scoper state when scoping a module.

@paulcadman paulcadman added this to the 0.6.0 milestone Jan 29, 2024
@paulcadman paulcadman force-pushed the fix-alias-import branch 2 times, most recently from d2c3351 to 0ea9ac3 Compare January 29, 2024 19:19
@janmasrovira janmasrovira requested a review from lukaszcz January 30, 2024 09:07
@janmasrovira janmasrovira force-pushed the fix-alias-import branch 2 times, most recently from e9047f1 to dc90b1d Compare January 31, 2024 08:46
@paulcadman paulcadman merged commit ab887e3 into main Jan 31, 2024
4 checks passed
@paulcadman paulcadman deleted the fix-alias-import branch January 31, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants