-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid using the current denotation in NamedType.disambiguate (#21414)
While recalculating denotation in NamedType (in `NamedType.memberDenot`, which itself can be called from `NamedType.computeDenot` or `NamedType.recomputeDenot`), it might call `NamedType.disambiguate` which uses a denotation to decide about the correct overloaded method. Using current denotation here might cause stale symbol errors, so instead we use the `lastKnownDenotation`, which should be enough for the use case here, as `targetName` should not change between phases/runs. Later in the denotation recalculation a similar thing happens with `SourceLanguage.apply`, where we also now avoid using currentDenotation, as whether the symbol comes from java or Scala 2 should also not change between phases/runs.
- Loading branch information
Showing
7 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
object Exports{ | ||
export OverloadedInline.* | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import scala.quoted.* | ||
|
||
object Macros{ | ||
|
||
inline def A() : String = { | ||
${ A_impl } | ||
} | ||
|
||
def A_impl(using Quotes): Expr[String] = { | ||
Expr("Whatever") | ||
} | ||
|
||
inline def B[T]: Int = { | ||
${ B_Impl[T] } | ||
} | ||
|
||
def B_Impl[T](using Quotes): Expr[Int] = { | ||
Expr(0) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Macros.* | ||
|
||
object OverloadedInline{ | ||
|
||
A() | ||
inline def overloaded_inline[T]: Unit = { | ||
overloaded_inline[T](0) | ||
} | ||
|
||
inline def overloaded_inline[T](dummy: Int): Unit = { | ||
val crash = B[T] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Exports.* | ||
|
||
object Test { | ||
overloaded_inline[Unit] | ||
} |