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

ruleguard: add loaded package deps to cache #194

Merged
merged 1 commit into from
Jan 30, 2021
Merged

Conversation

quasilyte
Copy link
Owner

Imagine that we import "dsl" from one file.
Any importer would also load "dsl/types" package since it's "dsl"
package dependency. So we would have both "dsl" and "dsl/types"
packages loaded.

Then other file imports "dsl" and "dsl/types" directly.
We load both of them, but only "dsl" is cached, so we load "dsl/types" again.
This leads to 2 versions of "dsl/types" (same content, different addresses)
and weird issues during the typechecking.

To avoid that, this patch adds all Complete() dependencies
of loaded (imported) package to the cache. With that change,
we would load "dsl/types" only once.

Fixes #193

Imagine that we import "dsl" from one file.
Any importer would also load "dsl/types" package since it's "dsl"
package dependency. So we would have both "dsl" and "dsl/types"
packages loaded.

Then other file imports "dsl" and "dsl/types" directly.
We load both of them, but only "dsl" is cached, so we load "dsl/types" again.
This leads to 2 versions of "dsl/types" (same content, different addresses)
and weird issues during the typechecking.

To avoid that, this patch adds all `Complete()` dependencies
of loaded (imported) package to the cache. With that change,
we would load "dsl/types" only once.

Fixes #193
@quasilyte quasilyte merged commit 90a3434 into master Jan 30, 2021
@quasilyte quasilyte deleted the quasilyte/fix/193 branch January 30, 2021 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule parsing error: typechecker.Check returns wrong type for method Underlying
1 participant