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

fix transitive export visibility in go schema parser #1449

Closed
Tracked by #1248
worstell opened this issue May 9, 2024 · 1 comment · Fixed by #1493
Closed
Tracked by #1248

fix transitive export visibility in go schema parser #1449

worstell opened this issue May 9, 2024 · 1 comment · Fixed by #1493
Assignees
Labels
bug Something isn't working urgent Work on this now

Comments

@worstell
Copy link
Collaborator

worstell commented May 9, 2024

during schema extraction we add the first data decl we come across in the AST traversal to the module schema. if the same type gets visited transitively later on, we don't update the export visibility if changed. this can result in transitively exported things not appearing in the module stubs

same problem for enums

@github-actions github-actions bot added the triage Issue needs triaging label May 9, 2024
@alecthomas alecthomas mentioned this issue May 9, 2024
@deniseli deniseli added next Work that will be be picked up next urgent Work on this now and removed triage Issue needs triaging next Work that will be be picked up next labels May 9, 2024
@alecthomas alecthomas added the bug Something isn't working label May 11, 2024
@alecthomas
Copy link
Collaborator

We couldn't quite figure out how to replicate this @worstell, so assigning to but if you to add reproduction notes (or fix if that's easier).

@matt2e matt2e assigned matt2e and unassigned worstell May 15, 2024
@matt2e matt2e linked a pull request May 15, 2024 that will close this issue
matt2e added a commit that referenced this issue May 16, 2024
#1238
Adds the ability to declare type aliases in modules
```
//ftl:typealias
type UserId string
```

There is a lot of overlap between typealiases and enums. They both
redefine an existing type as a new type, and therefore need to make sure
our schema parsing does not skip this defined type by looking at the
underlying type.
There were also issues if implicit exports, enum cases (and more?) were
encountered in the ast tree before we found the typealias or enum
definition.
This PR solves that by doing an initial pass just to find all typealias
and enum declarations for the module and then doing the normal pass.

Previously typealiases were allowed without any declaration but they
would just fall back to the underlying type.
This PR makes this an error as we do not know if this type should be an
enum or a type alias. We may want to discuss this more.

fixes #1475
#1476
#1477
#1492
#1449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working urgent Work on this now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants