diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-10-26 16:47:20 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-10-26 20:54:55 +0200 |
commit | 4e3ffd4bf00ab71ef64c31a45d5c3e2838aa78ee (patch) | |
tree | 6188a6d0106c39f84f7970cbc6fe73373c52d31f /src/reflect | |
parent | bd1858896f6546d778aa93c39b491ed5e2d7e0b3 (diff) | |
download | scala-4e3ffd4bf00ab71ef64c31a45d5c3e2838aa78ee.tar.gz scala-4e3ffd4bf00ab71ef64c31a45d5c3e2838aa78ee.tar.bz2 scala-4e3ffd4bf00ab71ef64c31a45d5c3e2838aa78ee.zip |
Don't follow type aliases in getClassByName and friends
This makes getClassByName fail / getClassIfDefined return NoSymbol
when querying an alias.
The current behavior can confuse the classfile parser: when parsing a
class, a cross-check verifies that `pool.getClassSymbol(nameIdx)`
returns the symbol of the class currently being parsed. If there's a
type alias that shadows the linked class, following the alias would
return an unrelated class.
(The cross-check didn't fail because there are some other guards
around it)
The logic to follow aliases was was added in ff98878, without a clear
explanation. Note that `requiredClass[C]` works if `C` is an alias, it
is expanded by the compiler.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/Mirrors.scala | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Mirrors.scala b/src/reflect/scala/reflect/internal/Mirrors.scala index 3d1c160d52..ff2bed8105 100644 --- a/src/reflect/scala/reflect/internal/Mirrors.scala +++ b/src/reflect/scala/reflect/internal/Mirrors.scala @@ -91,7 +91,6 @@ trait Mirrors extends api.Mirrors { private def ensureClassSymbol(fullname: String, sym: Symbol): ClassSymbol = { var result = sym - while (result.isAliasType) result = result.info.typeSymbol result match { case x: ClassSymbol => x case _ => MissingRequirementError.notFound("class " + fullname) |