| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| | |
Include 99f41a1 Merge pull request #5736
|
| |\
| | |
| | | |
SI-10206 tighten fix for SI-6889
|
| | |
| | |
| | |
| | |
| | | |
There are more supertypes of `AnyRef` than you might think:
`?{def clone: ?}` is one example...
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Don't emit a synthetic `apply` (or `unapply`) when it would
clash with an existing one. This allows e.g., a `private apply`,
along with a `case class` with a `private` constructor.
We have to retract the synthetic method in a pretty roundabout way,
as we need the other methods and the owner to be completed already.
Unless we have to complete the synthetic `apply` while completing
the user-defined one, this should not be a problem. If this does
happen, this implies there's a cycle in computing the user-defined
signature and the synthetic one, which is not allowed.
|
| | |
|
|\ \
| | |
| | | |
SI-8417 Check adapts of each param section
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, adaptations like auto-tupling were checked
only on the last param section of an application.
This commit runs the sanity check always.
|
|\ \ \
| | | |
| | | | |
Improved error messages for identically named, differently prefixed types
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Gaze deeper for errors before committing to conversion
of assignment to update. The error buried in the transformed
tree escapes notice of retypechecking and leaks to backend.
|
|\ \ \ \
| | | | |
| | | | | |
SI-10194: Fix abstract type resolution for overloaded HOFs
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Types in the applicable overload alternatives need to be seen from
the respective owners of the individual alternative, not from the
target’s owner (which can be a subtype of the types that define the
methods).
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Refactor lookupCompanion
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | | |
- Check for module class up front to use sourceModule
- Consolidate most of the logic in Contexts
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
SI-9881 Fix ImportHandler's reporting of importedNames and importedSymbols
|
| | |/ /
| |/| | |
|
|\ \ \ \
| | |/ /
| |/| | |
|
| |\ \ \
| | | | |
| | | | | |
SI-9636 More precise error pos on apply inference
|
| | |/ /
| | | |
| | | |
| | | |
| | | | |
If a method type arg is inferred Any, warn about the
function and not the innocent arg.
|
| |\ \ \
| | | | |
| | | | | |
SI-9675 warn about non-sensible equals in anonymous functions
|
| | |/ / |
|
| |\ \ \
| | | | |
| | | | | |
SI-10072 cast Function nodes to environment in specialization
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit basically make sure the fix for SI-5284 works correctly when
a Function node reaches specialization (`-Ydealmbdafy:method` and
IndyLambda are default in 2.12.x). To understand it, best read the
excellent description in b29c01b.
The code that's removed in this commit was added in 13ea590. It
prevented `castType` from being invoked on the `Function` node, which
is exactly what is needed here. It's also what happens under
`-Ydelambdafy:inline`, the `new anonfun()` tree is being casted from
`(Int, Int) => Int` to `(Int, A) => Int`.
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-10066 Fix crash in erroneous code with implicits, dynamic
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The compiler support in the typechecker for `scala.Dynamic` is
very particular about the `Context` in which it is typechecked.
It looks at the `tree` in the enclosing context to find the expression
immediately enclosing the dynamic selection. See the logic in
`dyna::mkInvoke` for the details.
This commit substitutes the result of `resetAttrs` into the tree
of the typer context before continuing with typechecking.
|
|\ \ \ \ \ \
| | |_|_|_|/
| |/| | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
A Scala method that implements a generic, Java-defined
varargs method, needs two bridges:
- to convert the collections for the repeated parameters (VBRIDGE)
- to bridge the generics gap (BRIDGE)
Refchecks emits the varargs "bridges", and erasure takes care
of the other gap. Because a VBRIDGE was also an ARTIFACT,
it was wrongly considered inert with respect to erasure,
because `OverridingPairs` by default excluded artifacts.
Removed the artifact flag from those VBRIDGES, so that they
qualify for a real bridge. It would also work to include
VBRIDGE methods that are artifacts in BridgesCursor.
|
|\| | | | |
| |/ / / /
|/| | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Time for the courage of our convictions: follow the advice of my
TODO comment from SI-8244 / f62e280825 and fix `classExistentialType`
once and for all.
This is the change in the generated `canEquals` method in the test
case; we no longer get a kind conformance error.
```
--- sandbox/old.log 2015-05-27 14:31:27.000000000 +1000
+++ sandbox/new.log 2015-05-27 14:31:29.000000000 +1000
@@ -15,7 +15,7 @@
case _ => throw new IndexOutOfBoundsException(x$1.toString())
};
override <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Stuff.this);
- <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[Proxy[PP]]]();
+ <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[_ <: [PP]Proxy[PP]]]();
override <synthetic> def hashCode(): Int = ScalaRunTime.this._hashCode(Stuff.this);
override <synthetic> def toString(): String = ScalaRunTime.this._toString(Stuff.this);
override <synthetic> def equals(x$1: Any): Boolean = x$1 match {
@@ -38,9 +38,3 @@
}
}
```
I also heeded my own advice to pass in a prefix to this method.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-10154 Fix implicit search regression for term-owned objects
|
| | |_|_|/
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
A recent change to fix lookup of companion implicits of term-owned
classes (#5550) caused a regression in the enclosed test case. The
previous approach of calling `Scope#lookup(companionName)` was
replaced by a lookup of the scope entry of the original name followed
by a narrower search lookup for the companion name, to ensure
that it was a true companion, and not just a same-named module
from defined at a different nested scope.
However, module class symbols are not themselves entered into
scopes, so the first part of the new scheme fails. We need to
add a special case modules here.
I've chosen to just call `.sourceModule` on module classes.
For module classes in the current run (all term owned symbols
will fall into this category), this amounts to using the value
of the field `ModuleClassSymbol#module`.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The error currently reads "only classes can have declared but undefined
members", which isn't true on two counts: traits can have them, and
concrete classes cannot. This corrects the error message to read "only
traits and abstract classes can have declared but undefined members".
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The narrow use case in the ticket was just to warn
on `C.apply` when the constructor has been
deprecated. Someone added code to warn after the
apply is rewritten, but it wasn't checking the
constructor (and the tree was checked before but
not after transform).
|
|\| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
If rewriting `x += y` fails to typecheck, emit error messages
for both the original tree and the assignment.
If rewrite is not attempted because `x` is a val, then say so.
The error message at `tree.pos` is updated with the additional advice.
SI-8763 Crash in update conversion
When there are already errors, don't attempt mechanical rewrites.
|
| |\ \ \
| | | | |
| | | | | |
[nomerge] Partial fix for SI-7046
|
| | | | | |
|
| |/ / / |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In refchecks, check that symbol with `@elidable` is a method.
When eliding in uncurry, doublecheck.
The check is enabled under `-Xsource:2.13`.
|
|\ \ \ \
| | | | |
| | | | | |
Remove deprecated -Y flags
|
| | | | |
| | | | |
| | | | |
| | | | | |
This was slated for removal in 2.12.
|
| | |_|/
| |/| |
| | | |
| | | | |
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
```
|
|\ \ \ \
| |_|/ /
|/| | | |
SI-10075 propagate annotations to lazy val's underlying field
|