Fixes #733 by bringing the rewritten definitions into scope, instead of old ones #754
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See discussion in #733 for how I traced down the bug. Summary:
At the point where we dealias the binding
l = m
, the core tree looks like:As it can be clearly seen,
l
is used in the join pointsb_k_...
.The bindings, after rewriting look like this.
It appears the renaming was successful. However, the rewritten defs are updated in the
InlineContext
, which can be seen by inspectingrewrite(List[Definition])
https://github.com/effekt-lang/effekt/blob/9007b059291153c7d9279ec729d62803a7b47275/effekt/shared/src/main/scala/effekt/core/Inline.scala#L88C7-L97
and its callsite:
effekt/effekt/shared/src/main/scala/effekt/core/Inline.scala
Lines 124 to 126 in 9007b05
So, the next time a
def
is inlined, the olddef
is inlined. It still refers to the old, aliased but now removed, binding... Hence causing the error.In this PR, I update the defs in the context to now contain the rewritten (dealiased) right hand sides.