Skip to content

Fix #9457 and #9626: Remove TermRef to inline parameters #9800

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

Conversation

nicolasstucki
Copy link
Contributor

For inline parameters we do not need to reeplace the parameter TermRef
with the proxy TermRef as this one will immediately be removed.

For inline parameters we do not need to reeplace the parameter TermRef
with the proxy TermRef as this one will immediately be removed.
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -673,7 +673,9 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
def apply(t: Type) = t match {
case t: ThisType => thisProxy.getOrElse(t.cls, t)
case t: TypeRef => paramProxy.getOrElse(t, mapOver(t))
case t: SingletonType => paramProxy.getOrElse(t, mapOver(t))
case t: SingletonType =>
if t.termSymbol.isAllOf(Inline | Param) then mapOver(t.widenTermRefExpr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about use a case specifically for TermRef:

case t @ TermRef(NoPrefix, _) if t.termSymbol.isAllOf(Inline | Param) =>
    mapOver(t.widenTermRefExpr)
case t: SingletonType =>
    paramProxy.getOrElse(t, mapOver(t))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my original code but den I redactores it to avoid the unnecessary extra type test.

@nicolasstucki nicolasstucki merged commit 835bb84 into scala:master Sep 16, 2020
@nicolasstucki nicolasstucki deleted the fix-missing-widening-of-inline-param-termrefs branch September 16, 2020 08:38
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

crash when inlining inline param bound to val _ Inline def with inlined tuple parameter crashes the compiler
3 participants