| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-10093 don't move member traits to constructor body in constructors
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes a regression introduced in c8e6050. Member traits with only
abstract definitions (`isInterface`) were moved into the primary
constructor by mistake. (Flatten moved the classes back.)
The member trait was duplicated into the constructor of specialized
subclasses, causing it to be generated multiple times.
Also removes some unnecessary `isMixinConstructor` checks: the mixin
constructor is always the primary constructor.
This commit also clarifies (and tests) what `isInterface` means: for
scala-defined traits, it means there are only abstract members. For
java-defined interfaces, it is always true.
|
| |
| |
| |
| |
| |
| |
| |
| | |
"sbt" is not an acronym (it used to be, but it isn't any longer).
It's a proper name, like "iPhone" or "eBay".
So, just like you wouldn't write "Get Started With EBay" or
"How To Reset Your IPhone", we don't write "Using the Sbt Build".
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
merge/2.11.x-to-2.12.x-20161220
Conflicts:
bincompat-backward.whitelist.conf
build.xml
src/compiler/scala/tools/nsc/typechecker/Typers.scala
src/library/scala/collection/immutable/NumericRange.scala
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since we don't parse Java expressions, fields of Java classes coming
from source files never have constant types. This prevents using
static java fields in annotation arguments in mixed compilation
This PR assigns constant types to final static java fields if the
initializer is a simple literal.
|
| |\ \
| | | |
| | | | |
SI-2712 Add support for higher order unification
|
| | | | |
|
| |\ \ \
| | | | |
| | | | | |
[nomerge] Partial fix for SI-7046
|
| | |/ / |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Manually tested with:
```
% cat sandbox/test.scala
package p {
object X { def f(i: Int) = ??? ; def f(s: String) = ??? }
object Main {
val res = X.f(3.14)
}
}
% qscalac -Ytyper-debug sandbox/test.scala
|-- p EXPRmode-POLYmode-QUALmode (site: package <root>)
| \-> p.type
|-- object X BYVALmode-EXPRmode (site: package p)
| |-- super EXPRmode-POLYmode-QUALmode (silent: <init> in X)
| | |-- this EXPRmode (silent: <init> in X)
| | | \-> p.X.type
| | \-> p.X.type
| |-- def f BYVALmode-EXPRmode (site: object X)
| | |-- $qmark$qmark$qmark EXPRmode (site: method f in X)
| | | \-> Nothing
| | |-- Int TYPEmode (site: value i in X)
| | | \-> Int
| | |-- Int TYPEmode (site: value i in X)
| | | \-> Int
| | \-> [def f] (i: Int)Nothing
| |-- def f BYVALmode-EXPRmode (site: object X)
| | |-- $qmark$qmark$qmark EXPRmode (site: method f in X)
| | | \-> Nothing
| | |-- String TYPEmode (site: value s in X)
| | | [adapt] String is now a TypeTree(String)
| | | \-> String
| | |-- String TYPEmode (site: value s in X)
| | | [adapt] String is now a TypeTree(String)
| | | \-> String
| | \-> [def f] (s: String)Nothing
| \-> [object X] p.X.type
|-- object Main BYVALmode-EXPRmode (site: package p)
| |-- X.f(3.14) EXPRmode (site: value res in Main)
| | |-- X.f BYVALmode-EXPRmode-FUNmode-POLYmode (silent: value res in Main)
| | | |-- X EXPRmode-POLYmode-QUALmode (silent: value res in Main)
| | | | \-> p.X.type
| | | \-> (s: String)Nothing <and> (i: Int)Nothing
| | |-- 3.14 BYVALmode-EXPRmode (silent: value res in Main)
| | | \-> Double(3.14)
| | [search #1] start `<?>`, searching for adaptation to pt=Double => String (silent: value res in Main) implicits disabled
| | [search #2] start `<?>`, searching for adaptation to pt=(=> Double) => String (silent: value res in Main) implicits disabled
| | [search #3] start `<?>`, searching for adaptation to pt=Double => Int (silent: value res in Main) implicits disabled
| | 1 implicits in companion scope
| | [search #4] start `<?>`, searching for adaptation to pt=(=> Double) => Int (silent: value res in Main) implicits disabled
| | 1 implicits in companion scope
| | second try: <error> and 3.14
| | [search #5] start `p.X.type`, searching for adaptation to pt=p.X.type => ?{def f(x$1: ? >: Double(3.14)): ?} (silent: value res in Main) implicits disabled
| | [search #6] start `p.X.type`, searching for adaptation to pt=(=> p.X.type) => ?{def f(x$1: ? >: Double(3.14)): ?} (silent: value res in Main) implicits disabled
sandbox/test.scala:4: error: overloaded method value f with alternatives:
(s: String)Nothing <and>
(i: Int)Nothing
cannot be applied to (Double)
val res = X.f(3.14)
^
```
|
| | |
| | |
| | |
| | |
| | |
| | | |
The boolean test for triples was inadvertently flipped.
Adds test for pretty printed multiline strings
|
|\ \ \
| | | |
| | | | |
Remove deprecated -Y flags
|
| | | |
| | | |
| | | |
| | | | |
This was slated for removal in 2.12.
|
|\ \ \ \
| | | | |
| | | | | |
SI-3772 Fix detection of term-owned companions
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Companion detection consults the scopes of enclosing Contexts during
typechecking to avoid the cycles that would ensue if we had to look
at into the info of enclosing class symbols. For example, this used
to typecheck:
object CC { val outer = 42 }
if ("".isEmpty) {
case class CC(c: Int)
CC.outer
}
This logic was not suitably hardened to find companions in exactly
the same nesting level.
After fixing this problem, a similar problem in `Namer::inCurrentScope`
could be solved to be more selective about synthesizing a companion
object. In particular, if a manually defined companion trails after
the case class, don't create an addiotional synthetic comanpanion object.
|
| |_|_|/
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
VarHandles bring a host of new "polymorphic signature" methods to
the Java 9 standard library. This commit updates the way we detect
such methods to look at the absense/presense of the
`PolymorphicSignature` annotation, so as to include these (and any
future additions.)
When we see applications of such methods, we disable adaptation
of argument and return types.
Tested manually with JDK9-ea:
```
Welcome to Scala 2.12.2-20161208-165912-3de1c0c (Java HotSpot(TM) 64-Bit Server VM, Java 9-ea).
Type in expressions for evaluation. Or try :help.
scala> import java.lang.invoke._, scala.runtime.IntRef
import java.lang.invoke._
import scala.runtime.IntRef
scala> val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
varHandle: java.lang.invoke.VarHandle = java.lang.invoke.VarHandleInts$FieldInstanceReadWrite@7112ce6
scala> varHandle.getAndSet(ref, 1): Int
res5: Int = 0
scala> varHandle.getAndSet(ref, 1): Int
res6: Int = 1
```
Inspecting bytecode shows the absense of box/unboxing:
```
object Test {
import java.lang.invoke._, scala.runtime.IntRef
val varHandle = MethodHandles.lookup().in(classOf[IntRef]).findVarHandle(classOf[IntRef], "elem", classOf[Int]);
def main(args: Array[String]): Unit = {
val i : Int = varHandle.getAndSet(IntRef.zero, 1)
}
}
```
```
public void main(java.lang.String[]);
Code:
0: aload_0
1: invokevirtual #28 // Method varHandle:()Ljava/lang/invoke/VarHandle;
4: invokestatic #34 // Method scala/runtime/IntRef.zero:()Lscala/runtime/IntRef;
7: iconst_1
8: invokevirtual #40 // Method java/lang/invoke/VarHandle.getAndSet:(Lscala/runtime/IntRef;I)I
11: istore_2
12: return
```
|
|\ \ \ \
| | | | |
| | | | | |
Remove existential infer hack enabled by #5376
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It wasn't a good idea after all.
Also removed some tracing code that I cannot imagine
was ever used in a production compiler. It's still just
a recompile away.
Fixes scala/scala-dev#280
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
http://openjdk.java.net/jeps/220 changes the layout of the
JDK to encapsulate the provided libraries with the new module
system.
This commit modifies the compiler's classpath implementation
to scan the new location of these, the `jrt://` virtual filesystem.
This might need to be adjusted once we provide a means for
users to specify the subset of modules that they want to
depend on, but for now reclaims the ground we lost.
```
⚡ (java_use 9-ea; qscala)
Welcome to Scala 2.12.0-20160908-223617-7e4ebda (Java HotSpot(TM) 64-Bit Server VM, Java 9-ea).
Type in expressions for evaluation. Or try :help.
scala> import StackWalker._, java.util.stream._, scala.collection.JavaConverters._
import StackWalker._
import java.util.stream._
import scala.collection.JavaConverters._
scala> (() => StackWalker.getInstance(java.util.EnumSet.of(Option.RETAIN_CLASS_REFERENCE)).walk[Seq[String]]((s: java.util.stream.Stream[StackFrame]) => s.iterator.asScala.take(3).map(_.toString).toList)).apply().mkString("\n")
res0: String =
.$anonfun$res0$1(<console>:21)
.<init>(<console>:21)
.<clinit>(<console>)
scala>
```
I've marked the new class, `NioFile` as `private[scala]` to justify
the forward compatibility whitelist entry.
In principle we could use NioFile more widely rather than `PlainFile`
I tried this out in https://github.com/retronym/scala/commit/b2d0a17a
which passed CI. But to be conservative, I'm not submitting that change
at this point.
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
SI-7046 reflection doesn't see all knownDirectSubclasses
This appears to do the right thing in the most typical scenarios in which `knownDirectSubclasses` would be used. The missing 5% is that subclasses defined in local scopes might not be seen by `knownDirectSubclasses` (see `Local` and `Riddle` in the test below). In mitigation, though, it is almost certain that a local subclass would represent an error in any scenario where `knownDirectSubclasses` might be used.
Errors for such situations are reported by recording (via a symbol attachment) that `knownDirectSubclasses` has been called and reporting an error if any additional children are added subsequently.
Despite these limitations and caveats, I believe that this represents a huge improvement over the status quo, and would eliminate 100% of the failures that I've seen in practice with people using shapeless for type class derivation.
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Clean up of code guarded by bare -Xexperimental
|
| | | | | |
|
| |/ / / |
|
|\ \ \ \
| | | | |
| | | | | |
SD-275 Further harden against refs to absentee classes
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
AFAICT, this was only needed to support pickle compatibility after
the fix for SI-1591. We don't need to maintain the compatibility
after incrementing our major version.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
- Limit the strategy of unpickling an external reference to a
module class to a lookup of the module var to non-stub owners
in order to enable fall through to stub symbol creation.
Fixes scala/scala-dev#275
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
- Rework previous fixes for SI-8502 to move the creation of
a term or type stub symbol during unpickling to the initial
point of stub creation, based on the tag.
- Just set the PACKAGE flag on class stub symbols created during
unpickling `ThisType`, rather than bothering with a different
subclass of `StubSymbol` for (assumed) packages.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-10009 Fields survive untypecheck/retypecheck
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Some places in the compiler, and many places in macros, use
`untypecheck` (aka `resetAttrs`) to strip types and local symbols
from a tree before retypechecking it under some different context.
The refactoring of the desugaring of vals and vars in Scala 2.12.0
broke an assumption in this facility.
When a ValDef must be split into multiple members (e.g. a field and
a getter, or a perhaps also a setter), the ValDef that was parsed
assumes the role of the `field`, and the trees for other members are
stached by `Namer` to the `synthetics` map of the compilation unit,
in order to spliced into the right statement list by typechecking.
See `enterGetterSetter` for more details.
However, the parsed ValDef is now used verbatim, carrying the meaning
(ie, the symbol) of the `private[this]` field. This tree now had
an inconsistency between the flags in `tree.mods.flags` and
`tree.symbol.flags`. `tree.name` also differed from `tree.symbol.name`
(the latter was renamed to be a local name, ie one with a trailing space.)
When `ResetAttrs` stripped off the symbol and we retypechecked, we'd
end up with two symbols in scope with the same name.
In the first from the `run` test:
```
================================================================================
{
class a extends scala.AnyRef {
def <init>(): a = {
a.super.<init>();
()
};
private[this] val x: Int = 42;
<stable> <accessor> def x: Int = a.this.x
};
new a()
}
{
class a extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
val x = 42; // oops, the name is "x" rather than "x " and we've missing `private[this]`!
<stable> <accessor> def x: Int = a.this.x
};
new a()
}
scala.tools.reflect.ToolBoxError: reflective typecheck has failed: x is already defined as value x
```
This commit uses the flags and name of the symbol in `typedValDef`.
I've also had to modify the internals of `CodePrinter` to use the
implicit, override, and deferred flags from the modifiers of an
accessor when recovering pre-typer tree for a ValDef.
|
|\ \ \ \ \
| |_|/ / /
|/| | | | |
Avoid name table pollution with fresh existentials
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
During large compilations runs, the large numbers of globally unique
fresh names for existentials captured from prefixes of `asSeenFrom`.
is a) somewhat wasteful (all these names are interned in the name table)
, and, b) form a pathological case for the current implementation of
`Names#hashValue`, which leads to overfull hash-buckets in the name table.
`hashValue` should probably be improved, but my attempts to do so have
shown a small performance degradation in some benchmarks. So this commit
starts by being more frugal with these names, only uniquely naming
within an `asSeenFrom` operation.
References scala/scala-dev#246
|
| |_|/ /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The REPL has a long running instance of Global which outputs
classfiles by default to a VirtualDirectory. The inliner did not find
any of these class files when compiling calls to methods defined in
previous runs (ie, previous lines of input.)
This commit:
- Adds a hook to augment the classpath that the optimizer searches,
and uses this in the REPL to add the output directory
- Fixes the implementation of `findClassFile` in VirtualDirectory,
which doesn't seem to have been used in anger before. I've factored out
some common code into a new method on `AbstractFile`.
- Fixes a similar problem getSubDir reported by Li Haoyi
- Adds missing unit test coverage.
This also fixes a bug in REPL autocompletion for types defined
in packages >= 2 level deep (with the `:paste -raw` command).
I've added a test for this case.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Cloning the original symbol in its entirety, rather than cloning
its type/value parameters individually. `cloneSymbol` takes care of
all the tricky substitutions for us!
|
| | | | |
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Make sure that methods annotated with varargs are properly mixed-in. This commit
splits the transformation into an info transformer (that works on all symbols, whether
they come from source or binary) and a tree transformer.
The gist of this is that the symbol-creation part of the code was moved to the UnCurry
info transformer, while tree operations remained in the tree transformer. The newly
created symbol is attached to the original method so that the tree transformer can still
retrieve the symbol.
A few fall outs:
- I removed a local map that was identical to TypeParamsVarargsAttachment
- moved the said attachment to StdAttachments so it’s visible between reflect.internal
and nsc.transform
- a couple more comments in UnCurry to honour the boy-scout rule
|
|\ \ \
| | | |
| | | | |
SI-9885 Don't return offset past EOF
|
| | | |
| | | |
| | | |
| | | |
| | | | |
On bad line number, `lineToOffset` should not return
an offset past EOF (which was sentinel, internally).
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
avoid boxing
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
scala.runtime.Rich{Double, Float} has `isNaN` and these are value class.
Also java.lang.{Double, Float} has `isNaN`.
- https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html#isNaN--
- https://docs.oracle.com/javase/8/docs/api/java/lang/Float.html#isNaN--
We can't call `RichDouble#isNaN` because
`implicit def double2Double(x: Double): java.lang.Double`
is higher priority than
`implicit def doubleWrapper(x: Double): RichDouble`
```
$ scala -version
Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL
$ scala -Xprint:jvm -e "1.0.isNaN"
[[syntax trees at end of jvm]] // scalacmd616162202928036892.scala
package <empty> {
object Main extends Object {
def main(args: Array[String]): Unit = {
new <$anon: Object>();
()
};
def <init>(): Main.type = {
Main.super.<init>();
()
}
};
final class anon$1 extends Object {
def <init>(): <$anon: Object> = {
anon$1.super.<init>();
scala.this.Predef.double2Double(1.0).isNaN();
()
}
}
}
```
|
| |_|/ /
|/| | |
| | | |
| | | |
| | | | |
to avoid the same kind of slowdowns that Vector was experiencing due
to the less aggressive inlining by scalac.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Tighten some types (Symbol -> ClassSymbol / ModuleSymbol), use NonFatal
instead of catching Throwable.
Also don't run the classfile parser enteringPhase(phaseBeforeRefchecks)
anymore. This was added in 0ccdb15 but seems no longer required.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When unpickling a class, if the name and owner matches the current
`classRoot` of the unpickling Scan, that `classRoot` symbol is used
instead of creating a new symbol.
If, in addition, the class being unpickled has the MODULE flag, the
unpickler should use the `moduleRoot.moduleClass` symbol (instead of
creating a new one).
To identify the module class, the current implementation compares the
name and owner to the `classRoot`. This fails in case the `classRoot`
is `NoSymbol`, which can happen in corner cases (when a type alias
shadows a class symbol, scala-dev#248).
In this patch we identify the module class by comparing the name and
owner to the `moduleRoot` symbol directly (using a `toTypeName`).
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In SymbolLoaders, when seeing a classfile `Foo.class`, we always
(unconditionally) create 3 symbols: a class, a module and a module
class. Some symbols get invalidated later (`.exists`).
Until now, the classfile parser (and unpickler) received the "root"
symbol as argument, which is the symbol whose type is being completed.
This is either the class symbol or the module symbol.
The classfile parser would then try to lookup the other symbol through
`root.companionClass` or `root.companionModule`. Howver, this lookup can
fail. One example is scala-dev#248: when a type alias (in a package
object) shadows a class symbol, `companionClass` will fail.
The implementations of the classfile parser / unpickler assume that
both the `clazz` and the `staticModule` symbols are available. This
change makes sure that they are always passed in explicitly.
Before this patch, in the example of scala-dev#248, the `classRoot` of
the unpickler was NoSymbol. This caused a bug when unpickling the
module class symbol, causing a second module class symbol to be created
mistakingly. The next commit cleans up this logic, more details there.
This second symbol would then cause the crash in the backend because it
doesn't have an `associatedFile`, therefore `isCoDefinedWith` would
spuriously return `true`.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This fixes scala/scala-dev#248, where a type alias reached the backend
through this method.
This is very similar to the fix for SI-5031, which changed it only in
ModuleSymbol, but not in Symbol.
The override in ModuleSymbol is actually unnecessary (it's identical),
so it's removed in this commit. It was added for unclear reasons in
296b706.
|
|\ \ \
| | | |
| | | | |
SI-9943 sealed class does not yield SAM type
|