summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Changes many calls to normalize to dealiasWiden.Paul Phillips2013-01-2920-53/+53
| | | | | | | | | | | | | Calling normalize is very aggressive and is usually the wrong thing. It is one of the leading contributors to non-determinism in compiler outcomes (often of the form "I gave a debugging or logging compiler option and it started/stopped working") and should be used only in very specific circumstances. Almost without exception, dealiasWiden is what you want; not widen, not normalize. If possible I will remove normalize from Type entirely, making it private to those areas of the compiler which actually require it.
* Renames normalize to normalizeModifiers.Paul Phillips2013-01-291-5/+5
| | | | Since we still have too many methods called normalize.
* Pending test for SI-5459.Paul Phillips2013-01-291-0/+48
|
* Merge pull request #1978 from retronym/ticket/6556-2Paul Phillips2013-01-271-12/+1
|\ | | | | SI-6556 Remove unneeded workaround in erasure.
| * SI-6556 Remove unneeded workaround in erasure.Jason Zaugg2013-01-261-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In fb6e687, a workaround was added, described as: > See SI-6556. It seems in some cases the result constructor > type of an anonymous class is a different version of the class. > This has nothing to do with value classes per se. > We simply used a less discriminating transform before, that > did not look at the cases in detail. > It seems there is a deeper problem here, which needs > following up to. But we will not risk regressions > in 2.10 because of it. I was expecting an arduous investigation into this, but happilly the underlying problem was already solved in the fix for SI-6648 (1587a77e). (Chalk up another win for libscala's scala-hash!) This commit escalates the logging to an assertion. It also reverts the other change in fb6e687, which introduced a case for RefinedType, which are not needed to pass pos/t6556.scala.
* | Merge pull request #1947 from secwall/masterPaul Phillips2013-01-261-1/+1
|\ \ | | | | | | Fixed typo in ProcessBuilder scaladoc.
| * | Fixed typo in ProcessBuilder scaladoc.secwall2013-01-221-1/+1
| | | | | | | | | | | | | | | ProcessBuilder creation sample code did not complie due to an error in import statement.
* | | Merge pull request #1864 from retronym/ticket/4859-6Paul Phillips2013-01-2618-36/+102
|\ \ \ | | | | | | | | | | | | SI-4859 Step back from mis-optimizations in qualifiers
| * | | Laying groundwork for a followup ticket.Jason Zaugg2013-01-264-8/+11
| | | | | | | | | | | | | | | | To solve SI-5304, we should change `isQualifierSafeToElide`.
| * | | SI-4859 Retain MODULE_LOAD in dead code elim.Jason Zaugg2013-01-262-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Without this, the following test fails: SCALAC_OPTS="-optimize" ./test/partest test/files/run/t4859.scala
| * | | SI-4859 Don't elide qualifiers when selecting nested modules.Jason Zaugg2013-01-265-5/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we fail to throw in: {???; Predef}.DummyImplicit.dummyImplicit We still elide the initialization of `Outer` in `Outer.Inner.foo` as before, although that seems a little dubious to me. In total, we had to change RefChecks, Flatten, and GenICode to effect this change. A recently fixed bug in tail call elimination was also due to assuming that the the qualifier of a Select node wasn't worthy of traversal. Let's keep a close eye out for more instances of this problem.
| * | | Wider use of isTopLevelJason Zaugg2013-01-2613-30/+30
| | | |
| * | | Introduce a new Symbol test: isTopLevel.Jason Zaugg2013-01-261-0/+3
| | | |
| * | | SI-4859 Don't rewrite CC().CC2() to new CC2Jason Zaugg2013-01-262-3/+8
| | |/ | |/| | | | | | | | | | | | | | | | | | | Where CC and CC2 are case classes. Attempting to do so leads to a "no legal prefix" error. Now, we restrict this optimization (living in RefChecks ?!) to case class applies with a "safe to inline" qualifier.
* | | Merge pull request #1901 from paulp/pr/dealias-plus-annotationsPaul Phillips2013-01-2630-199/+421
|\ \ \ | | | | | | | | dealiasing and annotations
| * | | Make sure typed isn't called with an erroneous tree.Paul Phillips2013-01-261-11/+15
| | | | | | | | | | | | | | | | | | | | I can't see that it makes any difference, but this is approximately the way it was before.
| * | | Put back a method which sbt is using.Paul Phillips2013-01-261-0/+7
| | | | | | | | | | | | | | | | Good catch, ant target sbt.compile.
| * | | A very interesting checkfile update.Paul Phillips2013-01-261-22/+22
| | | | | | | | | | | | | | | | Surely signfiicant, but I haven't determined in what way.
| * | | Add PolyType to Infer#normalize.Paul Phillips2013-01-264-13/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It arises when inferring the type of an overloaded call: def g(s: String): String = s def f: String = ??? def f[C](c: C): String = g(f) Also refined warning when isHKSubType is called with arguments which very likely were never meant to be compared.
| * | | Cleaning up dummy applied types and friends.Paul Phillips2013-01-267-86/+100
| | | | | | | | | | | | | | | | Incorporates feedback from dealias/widen PR.
| * | | Removing superfluous method parameters.Paul Phillips2013-01-261-25/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a method parameter with a default argument which deviates from the default at a single call site is a pretty questionable tradeoff. Even more so when done twice. Like sands through the hourglass, so go the parameters of our method.
| * | | Renamed methods to be less ambiguous in intent.Paul Phillips2013-01-267-42/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | isNamed => isNamedArg isIdentity => allArgsArePositional nameOf => nameOfNamedArg Moved mkNamedArg into TreeGen.
| * | | Added test for untested nested annotation restriction.Paul Phillips2013-01-262-0/+19
| | | |
| * | | SI-6083, misleading annotation error message.Paul Phillips2013-01-264-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | When an implicit conversion causes an apparently constant argument not to be constant, show the conversion, not the constant.
| * | | SI-5182, no position on annotation error.Paul Phillips2013-01-264-6/+20
| | | | | | | | | | | | | | | | Now there's a position on the synthetic "value" Ident.
| * | | SI-2577, SI-6860: annotation type inference.Paul Phillips2013-01-2610-27/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is less than ideal: scala> class Bippy[T] extends annotation.StaticAnnotation defined class Bippy scala> def f: Int @Bippy = 5 f: Int @Bippy[T] Turns out we can infer such types. Now it says: scala> def f: Int @Bippy = 5 f: Int @Bippy[Nothing] This should put to rest many an issue with parameterized annotations.
* | | | Merge pull request #1985 from paulp/pr/disable-6987Paul Phillips2013-01-262-0/+0
|\ \ \ \ | |/ / / |/| | | Disabled SI-6987.
| * | | Disabled SI-6987.Paul Phillips2013-01-262-0/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It causes spurious failures - a typical example: [partest] testing: [...]/files/run/t6987.scala [FAILED] [partest] did not get the string expected, full results were: [partest] Fast Scala compiler version 2.11.0-20130126-111937-f01e001c77 -- Copyright 2002-2013, LAMP/EPFL [partest] [Given arguments: -shutdown -verbose] [partest] [Transformed arguments: -shutdown -verbose -current-dir /localhome/jenkins/b/workspace/scala-checkin-manual] [partest] [VM arguments: ] [partest] java.net.ConnectException: Connection refused [partest] [Connecting to compilation daemon at port 32808 failed; re-trying...] [partest] [No compilation server running.] [partest]
* | | Merge pull request #1974 from paulp/pr/merge-2.10Paul Phillips2013-01-2662-117/+1133
|\ \ \ | |/ / |/| | Merge 2.10.x into master.
| * | Merge remote-tracking branch 'origin/2.10.x' into pr/merge-2.10Paul Phillips2013-01-2529-52/+507
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/2.10.x: SI-6969, mishandling of SoftReferences in method cache. SI-7011 Fix finding constructor type in captured var definitions SI-6987 Tests fsc verbose output SI-6987 Fixes fsc compile server verbose output SI-6231 Report unsupported free var capture by a trait. SI-6666 Restrict hidden `this` access in self/super calls. SI-6902 Check unreachability under @unchecked SI-6976 Fix value class separate compilation crasher. Closes SI-6952: add correct error positions for Dynamic feature check. Conflicts: src/compiler/scala/tools/nsc/CompileServer.scala src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
| | * \ Merge pull request #1956 from JamesIry/SI-7011_2.10.xJames Iry2013-01-253-2/+10
| | |\ \ | | | | | | | | | | SI-7011 Fix finding constructor type in captured var definitions
| | | * | SI-7011 Fix finding constructor type in captured var definitionsJames Iry2013-01-233-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a captured var was initialized with an empty tree then finding the type of the empty tree was being handled improperly. The fix is to look for primary constructors on the tree's type symbol rather than the tree's symbol. A test is included. In order to make the problem more testable the debug logging of the issue is changed to a debug warn.
| | * | | Merge pull request #1946 from retronym/ticket/6231Paul Phillips2013-01-254-3/+40
| | |\ \ \ | | | | | | | | | | | | SI-6231 Report unsupported free var capture by a trait.
| | | * | | SI-6231 Report unsupported free var capture by a trait.Jason Zaugg2013-01-214-3/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a class nested in a trait captures a free variable from the enclosing scope of the trait, the transformation to add that variable to the `init` method of the trait implementation class happens *after* the abstract trait interface has been extracted. This would lead to a crash when trying to find the corresponding interface method. This commit detects this situation and reports an implementation restriction. The enclosed test case shows a workaround. To lift this restriction, LambdaLifter should add the getters and make sure they end up in the trait interface. Looks like Martin tried this once: // LambdaLift.scala // // Disabled attempt to to add getters to freeParams // this does not work yet. Problem is that local symbols need local names // and references to local symbols need to be transformed into // method calls to setters. // def paramGetter(param: Symbol): Tree = { // val getter = param.newGetter setFlag TRANS_FLAG resetFlag PARAMACCESSOR // mark because we have to add them to interface // sym.info.decls.enter(getter) // val rhs = Select(gen.mkAttributedThis(sym), param) setType param.tpe // DefDef(getter, rhs) setPos tree.pos setType NoType // } // val newDefs = if (sym.isTrait) freeParams ::: (ps map paramGetter) else freeParams
| | * | | | Merge pull request #1951 from JamesIry/SI-6987_2.10.xPaul Phillips2013-01-254-17/+75
| | |\ \ \ \ | | | | | | | | | | | | | | SI-6987 Fixes fsc compile server verbose output
| | | * | | | SI-6987 Tests fsc verbose outputJames Iry2013-01-224-15/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit includes a test of fsc's verbose output. In order for it to work, CompileServer's main method had to be modified to remove a sys exit 0 at the end. It was redundant and made testing a bit harder. In order to prevent a race condition between server and client start up, this commit also adds a server callback that decrements a CountDownLatch that the main testing thread waits for. Finally, the server had to be modified to use Console.withErr and Console.withOut instead of mutating the global System.err and System.out variables. Otherwise the test would be unreliable.
| | | * | | | SI-6987 Fixes fsc compile server verbose outputJames Iry2013-01-222-2/+3
| | | | |/ / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Internally the fsc server code was setting a "verbose" flag, but it was always false. Fixing that gives server's verbose output, but because the output was buffered and not flushed the server's output wasn't seen until the compile run was complete. This commit fixes the verbose flag and flushes the server side output.
| | * | | | Merge pull request #1938 from retronym/ticket/6666Paul Phillips2013-01-253-7/+203
| | |\ \ \ \ | | | | | | | | | | | | | | SI-6666 Restrict hidden `this` access in self/super calls.
| | | * | | | SI-6666 Restrict hidden `this` access in self/super calls.Jason Zaugg2013-01-203-7/+203
| | | | |/ / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detect when classes (user authored or compiler generated) local to a self or super constructor argument would require premature access to the in-construction instance. The same restriction applies for classes and objects; for objects, the premature access would result in a null via MODULE$ field. A residual error has been lodged as SI-6997. I'd like to remove calls to `Symbol#outerClass` (which relies on the flaky flag INCONSTRUCTOR, see my comments in the JIRA issue for more discussion) from `LambdaLift` and `ExplicitOuter`, and instead use the stack of active self/super calls to know when to skip an enclosing class. That will obviate that flag.
| | * | | | Merge pull request #1928 from retronym/ticket/6902Paul Phillips2013-01-255-9/+55
| | |\ \ \ \ | | | | | | | | | | | | | | SI-6902 Check unreachability under @unchecked
| | | * | | | SI-6902 Check unreachability under @uncheckedJason Zaugg2013-01-195-9/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only exhaustiveness checking should be disabled if the scrutinee of a match as annotated as `: @unchecked`. This was the pre-2.10.x behaviour. This also fixes a variation of the closed ticket, SI-6011. The exhaustiveness check is needed to safely fallback from emitting a table switch if duplicate cases are detected.
| | * | | | | Merge pull request #1907 from namin/si-6952Paul Phillips2013-01-254-4/+23
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | Closes SI-6952: add correct error positions for Dynamic feature check.
| | | * | | | | Closes SI-6952: add correct error positions for Dynamic feature check.amin2013-01-164-4/+23
| | | | | | | |
| | * | | | | | Merge pull request #1902 from paulp/issue/6969Paul Phillips2013-01-253-7/+48
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-6969, mishandling of SoftReferences in method cache.
| | | * | | | | | SI-6969, mishandling of SoftReferences in method cache.Paul Phillips2013-01-243-7/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More interesting to test than it was to fix. The soft reference is now dereferenced once, the locally stored underlying value ascertained to be non-null, and the remainder of the references to the value use the local var. The enclosed test reliably NPEs without this patch.
| | * | | | | | | Merge pull request #1910 from retronym/ticket/6976Paul Phillips2013-01-254-4/+52
| | |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | SI-6976 Fix value class separate compilation crasher.
| | | * | | | | | | SI-6976 Fix value class separate compilation crasher.Jason Zaugg2013-01-164-4/+52
| | | | |_|/ / / / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't guarantee that the owner of the value class is initialized, and if it isn't, the search for the companion module will turn up bubkis. This is a localized fix, but I'd be suprised if there weren't other places that suffered from the same problem. Wouldn't it be nicer to have something like: // doesn't force info sym.raw.info sym.raw.companionModule // forces info sym.info sym.companionModule
| * | | | | | | | Merge commit 'd33ed9cea2' into pr/merge-2.10Paul Phillips2013-01-250-0/+0
| |\| | | | | | |
| | * | | | | | | Merge pull request #1966 from paulp/pr/fix-java7-againPaul Phillips2013-01-243-3/+25
| | |\ \ \ \ \ \ \ | | | |_|/ / / / / | | |/| | | | | | Fix java7 again
| | | * | | | | | Do not recompute stack frames when instrumenting bytecode.Grzegorz Kossakowski2013-01-242-25/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that we do not need to do that. See comment in `ProfilerVisitor.java`. Also, since recomputing stack frame map was the only reason we needed to implement `getCommonSuperClass` we can now remove its implementation that was causing problems on Java 7 due to a cyclic dependency involving class loader because we would try to load a class we are currently transforming and transformer is triggered just before classloading. //cc @namin who worked on this code with me.