From 2bfe0e797c2b9c57277475c9296e36cbf868b7db Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Fri, 18 Oct 2013 11:12:42 -0700 Subject: SI-6026 REPL checks for javap before tools.jar If javap is already available, don't go hunting for tools.jar This avoids the getResource bug in AbstractFileClassLoader. --- .../scala/tools/nsc/interpreter/ILoop.scala | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index 6aef72a3b8..ee45dc558a 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -394,20 +394,24 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) (install map (_.parent) flatMap jarAt) orElse (jdkDir flatMap deeply) } - private def addToolsJarToLoader() = { - val cl = platformTools match { - case Some(tools) => ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader) - case _ => intp.classLoader - } - if (Javap.isAvailable(cl)) { - repldbg(":javap available.") - cl - } - else { - repldbg(":javap unavailable: no tools.jar at " + jdkHome) + private def addToolsJarToLoader() = ( + if (Javap isAvailable intp.classLoader) { + repldbg(":javap available on interpreter class path.") intp.classLoader + } else { + val cl = platformTools match { + case Some(tools) => ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader) + case _ => intp.classLoader + } + if (Javap isAvailable cl) { + repldbg(":javap available on extended class path.") + cl + } else { + repldbg(s":javap unavailable: no tools.jar at $jdkHome") + intp.classLoader + } } - } + ) protected def newJavap() = new JavapClass(addToolsJarToLoader(), new IMain.ReplStrippingWriter(intp)) { override def tryClass(path: String): Array[Byte] = { -- cgit v1.2.3 From e350bd2cbc0183d5bedbdb8fd4101f93da30483b Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Fri, 18 Oct 2013 12:49:17 -0700 Subject: [nomaster] SI-6026 backport getResource bug fix Submitted to master under SI-4936, this fix allows :javap to work when tools.jar is discovered by REPL. --- .../tools/nsc/interpreter/AbstractFileClassLoader.scala | 16 +++++++++++++++- test/disabled/run/t6026.check | 9 +++++++++ test/disabled/run/t6026.scala | 9 +++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 test/disabled/run/t6026.check create mode 100644 test/disabled/run/t6026.scala diff --git a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala index 638bca8a72..59508fa951 100644 --- a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala @@ -7,7 +7,7 @@ package interpreter import scala.tools.nsc.io.{ File, AbstractFile } import util.ScalaClassLoader -import java.net.URL +import java.net.{ URL, URLConnection, URLStreamHandler } import scala.collection.{ mutable, immutable } /** @@ -55,10 +55,24 @@ class AbstractFileClassLoader(val root: AbstractFile, parent: ClassLoader) return file } + // parent delegation in JCL uses getResource; so either add parent.getResAsStream + // or implement findResource, which we do here as a study in scarlet (my complexion + // after looking at CLs and URLs) + override def findResource(name: String): URL = findAbstractFile(name) match { + case null => null + case file => new URL(null, "repldir:" + file.path, new URLStreamHandler { + override def openConnection(url: URL): URLConnection = new URLConnection(url) { + override def connect() { } + override def getInputStream = file.input + } + }) + } + // this inverts delegation order: super.getResAsStr calls parent.getRes if we fail override def getResourceAsStream(name: String) = findAbstractFile(name) match { case null => super.getResourceAsStream(name) case file => file.input } + // ScalaClassLoader.classBytes uses getResAsStream, so we'll try again before delegating override def classBytes(name: String): Array[Byte] = findAbstractFile(name) match { case null => super.classBytes(name) case file => file.toByteArray diff --git a/test/disabled/run/t6026.check b/test/disabled/run/t6026.check new file mode 100644 index 0000000000..779bb3ace5 --- /dev/null +++ b/test/disabled/run/t6026.check @@ -0,0 +1,9 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> class Foo +defined class Foo + +scala> :javap Foo +Compiled from ""public class Foo extends java.lang.Object{ public Foo();} +scala> diff --git a/test/disabled/run/t6026.scala b/test/disabled/run/t6026.scala new file mode 100644 index 0000000000..bee27bc72a --- /dev/null +++ b/test/disabled/run/t6026.scala @@ -0,0 +1,9 @@ + +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def code = +"""|class Foo + |:javap Foo + |""".stripMargin +} -- cgit v1.2.3 From 25bcba59ce37bdb19ec784edaecfd033eef27037 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 21 Oct 2013 09:33:25 +0200 Subject: SI-7295 Fix windows batch file with args containing parentheses In command scripts, substitution of `FOO` in `if cond ( %FOO% )` happens *before* the condition is evaluated. One can use delayed expansion with `if cond (!FOO!)` to get a saner behaviour. Or, as I ended up doing here, use a goto in the body of the if rather than referring directly to variables there. Here's a cut down version to demonstrate the old problem: C:\Users\IEUser>type test.cmd @echo off setlocal enableextensions enabledelayedexpansion if [%~1]==[-toolcp] ( set CP=%~2 shift shift ) echo -toolcp %CP% echo %~1 %~2 C:\Users\IEUser>test.cmd a b -toolcp a b C:\Users\IEUser>test.cmd -toolcp "c:\program files" a b -toolcp c:\program files a b C:\Users\IEUser>test.cmd -toolcp "c:\program files" "a()b" "c()d" -toolcp c:\program files a()b c()d C:\Users\IEUser>test.cmd "a()b" "c()d" d was unexpected at this time. I don't understand exactly why the parentheses only mess things up in this situation. But regardless, lets find another way. My first attempt to fix this was based on the suggestion in the ticket. But, as shown below, this fails to capture the -toolcp. C:\Users\IEUser>type test.cmd @echo off setlocal enableextensions enabledelayedexpansion if [%~1]==[-toolcp] ( set CP=!2! shift shift ) echo -toolcp %CP% echo %~1 %~2 C:\Users\IEUser>test.cmd "a()b" "c()d" -toolcp a()b c()d C:\Users\IEUser>test.cmd -toolcp "c:\program files" "a()b" "c()d" -toolcp a()b c()d Last stop was the goto you'll find in this patch. With this patch applied, I tested on Windows 8 with the following: C:\Users\IEUser>type Desktop\temp.cmd ::#! @echo off call scala %0 %* goto :eof ::!# println("hello, world") println(argv.toList) C:\Users\IEUser>scala Desktop\temp.cmd "foo(bar)baz" "java" -Xmx256M -Xms32M -Dscala.home="C:\PROGRA~3\scala\bin\.." -Denv.emacs="" -Dscala.usejavacp=true -cp "..." scala.tools.nsc.MainGenericRunner Desktop\temp.cmd "foo(bar)baz" hello, world List(foo(bar)baz) C:\Users\IEUser>scala -toolcp "c:\program files" Desktop\temp.cmd "foo(bar)baz" "java" -Xmx256M -Xms32M -Dscala.home="C:\PROGRA~3\scala\bin\.." -Denv.emacs="" -Dscala.usejavacp=true -cp "...;c:\program files" scala.tools.nsc.MainGenericRunner -toolcp "c:\program files" Desktop\temp.cmd "foo(bar)baz" hello, world List(foo(bar)baz) --- .../scala/tools/ant/templates/tool-windows.tmpl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl index 1288eb0b7c..8441f3af23 100644 --- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl @@ -12,15 +12,18 @@ setlocal enableextensions enabledelayedexpansion set _LINE_TOOLCP= -:another_param - rem Use "%~1" to handle spaces in paths. See http://ss64.com/nt/syntax-args.html -if "%~1"=="-toolcp" ( - set _LINE_TOOLCP=%~2 - shift - shift - goto another_param +rem SI-7295 The goto here is needed to avoid problems with `scala Script.cmd "arg(with)paren"`, +rem we must not evaluate %~2 eagerly, but delayed expansion doesn't seem to allow +rem removal of quotation marks. +if not [%~1]==[-toolcp] ( + goto :notoolcp ) +shift +set _LINE_TOOLCP=%~1 +shift + +:notoolcp rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments set _JAVA_PARAMS= -- cgit v1.2.3 From ce74bb00603f23087fbd3b0fe2870f09d73bb676 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sat, 25 May 2013 22:57:33 +0200 Subject: [nomaster] SI-7519 Less brutal attribute resetting in adapt fallback Prefers `resetLocalAttrs` over `resetAllAttrs`. The latter loses track of which enclosing class of the given name is referenced by a `This` node which prefixes the an applied implicit view. The code that `resetAllAttrs` originally landed in: https://github.com/scala/scala/commit/d4c63b#L6R804 Cherry picked from 433880e91cba9e1e926e9fcbf04ecd4aeb1d73eb Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 +++-- test/files/neg/t7519.check | 7 +++++++ test/files/neg/t7519.scala | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 test/files/neg/t7519.check create mode 100644 test/files/neg/t7519.scala diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index e27f540a7d..48e7e3a38c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -876,8 +876,9 @@ trait Typers extends Modes with Adaptations with Tags { case SilentResultValue(result) => result case _ => - debuglog("fallback on implicits: " + tree + "/" + resetAllAttrs(original)) - val tree1 = typed(resetAllAttrs(original), mode, WildcardType) + val resetTree = resetLocalAttrs(original) + debuglog(s"fallback on implicits: ${tree}/$resetTree") + val tree1 = typed(resetTree, mode, WildcardType) // Q: `typed` already calls `pluginsTyped` and `adapt`. the only difference here is that // we pass `EmptyTree` as the `original`. intended? added in 2009 (53d98e7d42) by martin. tree1.tpe = pluginsTyped(tree1.tpe, this, tree1, mode, pt) diff --git a/test/files/neg/t7519.check b/test/files/neg/t7519.check new file mode 100644 index 0000000000..164d67f595 --- /dev/null +++ b/test/files/neg/t7519.check @@ -0,0 +1,7 @@ +t7519.scala:5: error: could not find implicit value for parameter nada: Nothing + locally(0 : String) // was: "value conversion is not a member of C.this.C" + ^ +t7519.scala:15: error: could not find implicit value for parameter nada: Nothing + locally(0 : String) // was: "value conversion is not a member of U" + ^ +two errors found diff --git a/test/files/neg/t7519.scala b/test/files/neg/t7519.scala new file mode 100644 index 0000000000..aea0f35d8e --- /dev/null +++ b/test/files/neg/t7519.scala @@ -0,0 +1,18 @@ +class C { + implicit def conversion(m: Int)(implicit nada: Nothing): String = ??? + + class C { // rename class to get correct error, can't find implicit: Nothing. + locally(0 : String) // was: "value conversion is not a member of C.this.C" + } +} + +object Test2 { + trait T; trait U + new T { + implicit def conversion(m: Int)(implicit nada: Nothing): String = ??? + + new U { // nested anonymous classes also share a name. + locally(0 : String) // was: "value conversion is not a member of U" + } + } +} -- cgit v1.2.3 From 50c8b39ec4e795b6de7b8ebeb6e20bf5c4b7f9e0 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Fri, 18 Oct 2013 16:39:26 -0400 Subject: SI-7519: Additional test case covering sbt/sbt#914 (cherry picked from commit e72c32db03b44d6eaf1c1872765a578c5445e15f) --- test/files/neg/t7519-b.check | 4 ++++ test/files/neg/t7519-b/Mac_1.scala | 14 ++++++++++++++ test/files/neg/t7519-b/Use_2.scala | 8 ++++++++ 3 files changed, 26 insertions(+) create mode 100644 test/files/neg/t7519-b.check create mode 100644 test/files/neg/t7519-b/Mac_1.scala create mode 100644 test/files/neg/t7519-b/Use_2.scala diff --git a/test/files/neg/t7519-b.check b/test/files/neg/t7519-b.check new file mode 100644 index 0000000000..ad554b8633 --- /dev/null +++ b/test/files/neg/t7519-b.check @@ -0,0 +1,4 @@ +Use_2.scala:6: error: No implicit view available from String => K. + val x: Q = ex.Mac.mac("asdf") + ^ +one error found diff --git a/test/files/neg/t7519-b/Mac_1.scala b/test/files/neg/t7519-b/Mac_1.scala new file mode 100644 index 0000000000..55b583d24b --- /dev/null +++ b/test/files/neg/t7519-b/Mac_1.scala @@ -0,0 +1,14 @@ +// get expected error message without package declaration +package ex + +import scala.language.experimental.macros +import scala.reflect.macros._ + +object IW { + def foo(a: String): String = ??? +} +object Mac { + def mac(s: String): String = macro macImpl + def macImpl(c: Context)(s: c.Expr[String]): c.Expr[String] = + c.universe.reify(IW.foo(s.splice)) +} diff --git a/test/files/neg/t7519-b/Use_2.scala b/test/files/neg/t7519-b/Use_2.scala new file mode 100644 index 0000000000..413e40e25e --- /dev/null +++ b/test/files/neg/t7519-b/Use_2.scala @@ -0,0 +1,8 @@ +trait Q +trait K + +object Use { + implicit def cd[T](p: T)(implicit ev: T => K): Q = ??? + val x: Q = ex.Mac.mac("asdf") +} + -- cgit v1.2.3 From 075f6f260ccfba83b118c308195d1ede2e66ad18 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 4 Nov 2013 16:51:20 -0800 Subject: SI-6546 InnerClasses attribute refers to absent class At issue is that the optimizer would eliminate closure classes completely, then neglect to eliminate those classes from the container's InnerClasses attribute. This breaks tooling which expects those entries to correspond to real classes. The code change is essentially mgarcia's - I minimized it and put the caches in perRunCaches, and added the test case which verifies that after being compiled under -optimise, there are no inner classes. Before/after: 7,8d6 < InnerClasses: < public final #22; //class A_1$$anonfun$f$1 37,45c35,40 < #21 = Utf8 A_1$$anonfun$f$1 < #22 = Class #21 // A_1$$anonfun$f$1 < #23 = Utf8 Code --- > #21 = Utf8 Code --- src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 4 +++- .../scala/tools/nsc/backend/opt/DeadCodeElimination.scala | 8 +++++++- test/files/run/t6546.flags | 1 + test/files/run/t6546/A_1.scala | 6 ++++++ test/files/run/t6546/B_2.scala | 8 ++++++++ 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/files/run/t6546.flags create mode 100644 test/files/run/t6546/A_1.scala create mode 100644 test/files/run/t6546/B_2.scala diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 7c46d648fe..97140aca2e 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -86,6 +86,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { if (settings.Xdce.value) for ((sym, cls) <- icodes.classes if inliner.isClosureClass(sym) && !deadCode.liveClosures(sym)) { log(s"Optimizer eliminated ${sym.fullNameString}") + deadCode.elidedClosures += sym icodes.classes -= sym } @@ -624,7 +625,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { innerClassBuffer += m } - val allInners: List[Symbol] = innerClassBuffer.toList + val allInners: List[Symbol] = innerClassBuffer.toList filterNot deadCode.elidedClosures + if (allInners.nonEmpty) { debuglog(csym.fullName('.') + " contains " + allInners.size + " inner classes.") diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala index 1beed3f420..db56f61f16 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala @@ -40,7 +40,13 @@ abstract class DeadCodeElimination extends SubComponent { } /** closures that are instantiated at least once, after dead code elimination */ - val liveClosures: mutable.Set[Symbol] = new mutable.HashSet() + val liveClosures = perRunCaches.newSet[Symbol]() + + /** closures that are eliminated, populated by GenASM.AsmPhase.run() + * these class symbols won't have a .class physical file, thus shouldn't be included in InnerClasses JVM attribute, + * otherwise some tools get confused or slow (SI-6546) + * */ + val elidedClosures = perRunCaches.newSet[Symbol]() /** Remove dead code. */ diff --git a/test/files/run/t6546.flags b/test/files/run/t6546.flags new file mode 100644 index 0000000000..eb4d19bcb9 --- /dev/null +++ b/test/files/run/t6546.flags @@ -0,0 +1 @@ +-optimise \ No newline at end of file diff --git a/test/files/run/t6546/A_1.scala b/test/files/run/t6546/A_1.scala new file mode 100644 index 0000000000..bd086c08f8 --- /dev/null +++ b/test/files/run/t6546/A_1.scala @@ -0,0 +1,6 @@ +final class Opt { + @inline def getOrElse(x: => String): String = "" +} +class A_1 { + def f(x: Opt): String = x getOrElse null +} diff --git a/test/files/run/t6546/B_2.scala b/test/files/run/t6546/B_2.scala new file mode 100644 index 0000000000..64ec966f75 --- /dev/null +++ b/test/files/run/t6546/B_2.scala @@ -0,0 +1,8 @@ +import scala.tools.partest.BytecodeTest + +object Test extends BytecodeTest { + def show: Unit = { + val node = loadClassNode("A_1") + assert(node.innerClasses.isEmpty, node.innerClasses) + } +} -- cgit v1.2.3 From e09a8a2b7f821be43703bd5bf3a064e171d8f66c Mon Sep 17 00:00:00 2001 From: Vlad Ureche Date: Mon, 2 Sep 2013 19:08:49 +0200 Subject: SI-4012 Mixin and specialization work well The bug was fixed along with SI-7638 in 504b5f3. --- test/files/pos/SI-4012-a.scala | 7 +++++++ test/files/pos/SI-4012-b.scala | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/files/pos/SI-4012-a.scala create mode 100644 test/files/pos/SI-4012-b.scala diff --git a/test/files/pos/SI-4012-a.scala b/test/files/pos/SI-4012-a.scala new file mode 100644 index 0000000000..7fceeea3c3 --- /dev/null +++ b/test/files/pos/SI-4012-a.scala @@ -0,0 +1,7 @@ +trait C1[+A] { + def head: A = sys.error("") +} +trait C2[@specialized +A] extends C1[A] { + override def head: A = super.head +} +class C3 extends C2[Char] diff --git a/test/files/pos/SI-4012-b.scala b/test/files/pos/SI-4012-b.scala new file mode 100644 index 0000000000..6bc8592766 --- /dev/null +++ b/test/files/pos/SI-4012-b.scala @@ -0,0 +1,15 @@ +trait Super[@specialized(Int) A] { + def superb = 0 +} + +object Sub extends Super[Int] { + // it is expected that super[Super].superb crashes, since + // specialization does parent class rewiring, and the super + // of Sub becomes Super$mcII$sp and not Super. But I consider + // this normal behavior -- if you want, I can modify duplicatiors + // to make this work, but I consider it's best to keep this + // let the user know Super is not the superclass anymore. + // super[Super].superb - Vlad + super.superb // okay + override def superb: Int = super.superb // okay +} -- cgit v1.2.3 From 6045a05b833c930dfaf343215ac645f4f32f3e2a Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 6 Nov 2013 14:58:01 +0100 Subject: Fix completion after application with implicit arguments `List(1, 2, 3).map(f).` now works; before the tree had the type `(bf: CanBuildFrom[...]):...` and did not contribute completions from the result type. This commit checks if the tree has an implicit method type, and typechecks it as a qualifier. That is enough to get to `adaptToImplicitMethod` in the type checker, infer the implicit arguments, and compute the final result type accordingly. --- .../scala/tools/nsc/interactive/Global.scala | 9 +++++-- .../presentation/completion-implicit-chained.check | 29 ++++++++++++++++++++++ .../completion-implicit-chained/Test.scala | 3 +++ .../src/Completions.scala | 12 +++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 test/files/presentation/completion-implicit-chained.check create mode 100644 test/files/presentation/completion-implicit-chained/Test.scala create mode 100644 test/files/presentation/completion-implicit-chained/src/Completions.scala diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 84670750d7..49f6cb2373 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -999,7 +999,13 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") val context = doLocateContext(pos) - if (tree.tpe == null) + val shouldTypeQualifier = tree.tpe match { + case null => true + case mt: MethodType => mt.isImplicit + case _ => false + } + + if (shouldTypeQualifier) // TODO: guard with try/catch to deal with ill-typed qualifiers. tree = analyzer.newTyper(context).typedQualifier(tree) @@ -1192,4 +1198,3 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") } object CancelException extends Exception - diff --git a/test/files/presentation/completion-implicit-chained.check b/test/files/presentation/completion-implicit-chained.check new file mode 100644 index 0000000000..6d30a61cf9 --- /dev/null +++ b/test/files/presentation/completion-implicit-chained.check @@ -0,0 +1,29 @@ +reload: Completions.scala + +askTypeCompletion at Completions.scala(11,16) +================================================================================ +[response] aksTypeCompletion at (11,16) +retrieved 24 members +[accessible: true] `method !=(x$1: Any)Boolean` +[accessible: true] `method !=(x$1: AnyRef)Boolean` +[accessible: true] `method ##()Int` +[accessible: true] `method ==(x$1: Any)Boolean` +[accessible: true] `method ==(x$1: AnyRef)Boolean` +[accessible: true] `method asInstanceOf[T0]=> T0` +[accessible: true] `method eq(x$1: AnyRef)Boolean` +[accessible: true] `method equals(x$1: Any)Boolean` +[accessible: true] `method hashCode()Int` +[accessible: true] `method isInstanceOf[T0]=> Boolean` +[accessible: true] `method map(x: Int => Int)(implicit a: DummyImplicit)test.O.type` +[accessible: true] `method ne(x$1: AnyRef)Boolean` +[accessible: true] `method notify()Unit` +[accessible: true] `method notifyAll()Unit` +[accessible: true] `method synchronized[T0](x$1: T0)T0` +[accessible: true] `method toString()String` +[accessible: true] `method wait()Unit` +[accessible: true] `method wait(x$1: Long)Unit` +[accessible: true] `method wait(x$1: Long, x$2: Int)Unit` +[accessible: true] `value prefix123Int` +[accessible: false] `method clone()Object` +[accessible: false] `method finalize()Unit` +================================================================================ diff --git a/test/files/presentation/completion-implicit-chained/Test.scala b/test/files/presentation/completion-implicit-chained/Test.scala new file mode 100644 index 0000000000..bec1131c4c --- /dev/null +++ b/test/files/presentation/completion-implicit-chained/Test.scala @@ -0,0 +1,3 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest \ No newline at end of file diff --git a/test/files/presentation/completion-implicit-chained/src/Completions.scala b/test/files/presentation/completion-implicit-chained/src/Completions.scala new file mode 100644 index 0000000000..67922dfec0 --- /dev/null +++ b/test/files/presentation/completion-implicit-chained/src/Completions.scala @@ -0,0 +1,12 @@ +package test + +import scala.Predef.DummyImplicit // turn off other predef implicits for a cleaner .check file. + +object O { + def map(x: Int => Int)(implicit a: DummyImplicit): O.type = this + val prefix123 : Int = 0 +} + +class Foo { + O.map(x => x)./*!*/ // we want the presentation compiler to apply the implicit argument list. +} -- cgit v1.2.3 From ba0718fd1db18f4f88700d3d545b9010414b6ce4 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 6 Nov 2013 09:55:20 -0800 Subject: Render relevant properties to buildcharacter.properties --- build.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.xml b/build.xml index 8930f0a56c..504d9390af 100644 --- a/build.xml +++ b/build.xml @@ -416,6 +416,17 @@ TODO: + + + + + + + + + + + -- cgit v1.2.3 From 40af1e0c44725f27d391b68922f4c8e3cbde9df5 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 6 Nov 2013 09:56:58 -0800 Subject: Allow publishing only core (pr validation) --- src/build/maven/maven-deploy.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml index e70173319e..150175bdc4 100644 --- a/src/build/maven/maven-deploy.xml +++ b/src/build/maven/maven-deploy.xml @@ -176,6 +176,16 @@ + + + + + + + + + + @@ -268,6 +278,11 @@ + + + + + -- cgit v1.2.3 From 852a9479d02e152df9156bc6303b70dea9db9a41 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 6 Nov 2013 11:44:08 -0800 Subject: Allow retrieving STARR from non-standard repo for PR validation --- build.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.xml b/build.xml index 504d9390af..bb030d35cd 100644 --- a/build.xml +++ b/build.xml @@ -240,12 +240,15 @@ TODO: + + + -- cgit v1.2.3 From d15ed081efdcb70bb77b5f76b2ac36a7e6b009ba Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Fri, 8 Nov 2013 09:13:21 +0100 Subject: [backport] SI-7776 post-erasure signature clashes are now macro-aware "double definition: macro this and method that have same type after erasure" This error doesn't make sense when macros are involved, because macros expand at compile-time, where we're not affected by erasure. Moreover, macros produce no bytecode, which means that we're safe from VerifyErrors. --- src/compiler/scala/tools/nsc/transform/Erasure.scala | 8 ++++++-- test/files/pos/t7776.check | 0 test/files/pos/t7776.scala | 12 ++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 test/files/pos/t7776.check create mode 100644 test/files/pos/t7776.scala diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 76249974ac..abd3262c56 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -895,6 +895,9 @@ abstract class Erasure extends AddInterfaces * but their erased types are the same. */ private def checkNoDoubleDefs(root: Symbol) { + def sameTypeAfterErasure(sym1: Symbol, sym2: Symbol) = + afterPostErasure(sym1.info =:= sym2.info) && !sym1.isMacro && !sym2.isMacro + def doubleDefError(sym1: Symbol, sym2: Symbol) { // the .toString must also be computed at the earlier phase val tpe1 = afterRefchecks(root.thisType.memberType(sym1)) @@ -920,7 +923,7 @@ abstract class Erasure extends AddInterfaces if (e.sym.isTerm) { var e1 = decls.lookupNextEntry(e) while (e1 ne null) { - if (afterPostErasure(e1.sym.info =:= e.sym.info)) doubleDefError(e.sym, e1.sym) + if (sameTypeAfterErasure(e1.sym, e.sym)) doubleDefError(e.sym, e1.sym) e1 = decls.lookupNextEntry(e1) } } @@ -939,7 +942,8 @@ abstract class Erasure extends AddInterfaces while (opc.hasNext) { if (!afterRefchecks( root.thisType.memberType(opc.overriding) matches - root.thisType.memberType(opc.overridden))) { + root.thisType.memberType(opc.overridden)) && + sameTypeAfterErasure(opc.overriding, opc.overridden)) { debuglog("" + opc.overriding.locationString + " " + opc.overriding.infosString + opc.overridden.locationString + " " + diff --git a/test/files/pos/t7776.check b/test/files/pos/t7776.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/files/pos/t7776.scala b/test/files/pos/t7776.scala new file mode 100644 index 0000000000..0340facd1b --- /dev/null +++ b/test/files/pos/t7776.scala @@ -0,0 +1,12 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +class MacroErasure { + def app(f: Any => Any, x: Any): Any = macro MacroErasure.appMacro + def app[A](f: A => Any, x: Any): Any = macro MacroErasure.appMacroA[A] +} + +object MacroErasure { + def appMacro(c: Context)(f: c.Expr[Any => Any], x: c.Expr[Any]): c.Expr[Any] = ??? + def appMacroA[A](c: Context)(f: c.Expr[A => Any], x: c.Expr[Any])(implicit tt: c.WeakTypeTag[A]): c.Expr[Any] = ??? +} \ No newline at end of file -- cgit v1.2.3 From 31ead67a301b2654ec06f0858d7e6c4429e3d33a Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 7 Nov 2013 12:17:16 -0800 Subject: IDE needs swing/actors/continuations --- src/build/maven/maven-deploy.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml index 150175bdc4..8da1d76a6f 100644 --- a/src/build/maven/maven-deploy.xml +++ b/src/build/maven/maven-deploy.xml @@ -176,6 +176,7 @@ + @@ -183,6 +184,10 @@ + + + + -- cgit v1.2.3 From 1d29c0a08b25e041a55a626f88543166dab84e21 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sun, 10 Nov 2013 03:58:03 -0800 Subject: [backport] Add buildcharacter.properties to .gitignore. (cherry picked from commit 693e55e1cb75055bb243ffca2e18b8e44e80bb8c) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f90835d970..4329fce06f 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ # Developer specific Ant properties /build.properties +/buildcharacter.properties # target directories for ant build /build/ -- cgit v1.2.3