summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* [backport] SI-5378, unsoundness with type bounds in refinements.Paul Phillips2013-01-284-48/+135
| | | | | | | | | | | | | | | | | As the comment says: Not enough to look for abstract types; have to recursively check the bounds of each abstract type for more abstract types. Almost certainly there are other exploitable type soundness bugs which can be seen by bounding a type parameter by an abstract type which itself is bounded by an abstract type. SPECIAL: BUY ONE UNSOUNDNESS, GET ONE FREE In refinement types, only the first parameter list of methods was being analyzed for unsound uses of abstract types. Second parameter list and beyond had free unsoundness reign. That bug as well is fixed here.
* Merge pull request #1973 from JamesIry/SI-4602_2.10.xJames Iry2013-01-283-7/+75
|\ | | | | SI-4602 Make fsc absolutize source file names
| * SI-4602 Disable unreliable test of fsc path absolutizationJames Iry2013-01-271-0/+0
| | | | | | | | | | | | | | | | The included test for fsc path absolutization almost certainly has the same reliability problem as a similar test that was disabled in https://github.com/scala/scala/pull/1985 . Disabling the test until I can figure out a reliable way to test fsc in an our continuous integration environment.
| * SI-4602 Make fsc absolutize source file namesJames Iry2013-01-253-7/+75
| | | | | | | | | | | | | | | | | | | | | | | | The fsc server was using a path supplied by the client to turn things like class path values into absolute paths. But it wasn't absolutizing the source file names supplied to the compiler which lead to SI-4602. This commit adds that absolutizing bit and cleans the logic up a bit so that the settings object isn't told a path that it already knows. A test is included that simulates changing directory by forcing two different -current-dir settings on two different compile sessions on the same server process.
* | Merge pull request #1988 from melloc/fsc-temporary-directory-2.10.xJames Iry2013-01-281-1/+1
|\ \ | | | | | | SI-4733 - fsc no longer creates a single temp directory for all users.
| * | SI-4733 - fsc no longer creates a single temp directory for all users.Cody Mello2013-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fsc previously created a single temporary directory called "scala-devel". This is an issue, since the directory belongs to whoever created the directory. Depending on the user's umask, this directory may only be writable for the creator. This causes problems for any other users who then try to use fsc or invoke fsc indirectly. Other programs usually solve this issue by creating a separate directory for each user, either by appending the username to a base directory name or creating a new direcotory with a random name with a program like "mktemp". This commit changes CompileSocket to use the first method. Fixes SI-4733 backport to 2.10.x
* | | Merge pull request #1927 from JamesIry/SI-6863_2.10.xJames Iry2013-01-283-10/+147
|\ \ \ | | | | | | | | SI-6863 Fix verify error in captured var inited from block w try/catch
| * | | SI-6863 Fix verify error in captured var inited from expr with try/catchJames Iry2013-01-253-10/+147
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a captured var was inited from a try/catch we did something reasonable. But if the var was inited from a more complicated expression (if/else, a block, match/case, etc) that ended with a try/catch then we didn't and we were generating faulty byte code. This fix patches LambdaLift to add the missing cases. For known simple expressions, the translation is just new *Ref(expr). For try/catch, if/else, match/case, and blocks this recursively walks down the internal result expressions to translate them. E.g. if(cond) trueExpr else falseExpr becomes if(cone) translate(trueExpr) else translate(falseExpr) For unknown expression types, the translation is {val temp = expr; new *Ref(expr) }
* | | Merge pull request #1941 from phaller/issue/6932-futures-internal-callbacksAdriaan Moors2013-01-273-3/+127
|\ \ \ | | | | | | | | SI-6932 StackOverflowError in chained Future.flatMap calls
| * | | SI-6932 Remove Batchable trait plus minor clean-upsPhilipp Haller2013-01-211-18/+9
| | | |
| * | | Fix SI-6932 by enabling linearization of callback execution for the ↵Viktor Klang2013-01-213-3/+136
| | | | | | | | | | | | | | | | internal execution context of Future
* | | | Merge pull request #1857 from retronym/ticket/6443-2.10.xAdriaan Moors2013-01-2710-7/+222
|\ \ \ \ | | | | | | | | | | SI-6443 Widen dependent param types in uncurry
| * | | | SI-6443 Expand test coverage with varargs, by-name.Jason Zaugg2013-01-164-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were already working, due to a serendipitous ordering of transformations. The tests will keep it this way.
| * | | | SI-6443 Widen dependent param types in uncurryJason Zaugg2013-01-166-7/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bridge building operates on unusual method signatures: after uncurry, so parameter lists are collapsed; but before erasure, so dependently typed parameters are still around. Original: def foo(a: T)(b: a.type, c: a.U): Unit During computeBridges: (a: T, b: a.type, c: a.U)Unit This signature no longer appears to override the corresponding one in a superclass, because the types of `b` and `c` are dependent on method parameters. The root of the problem is uncurry, which leaves the trees in a poor state. This commit changes uncurry to remedy this. An example illustrates it best: // source def foo(a: A)(b: a.type): b.type = b // post uncurry before this patch. // not well typed code! def foo(a: A, b: a.type): a.type = { // post uncurry after this patch def foo(a: A, b: A): A = { val b$1 = b.asInstanceOf[a.type] b$1 }
* | | | | Merge pull request #1977 from retronym/ticket/7018Jason Zaugg2013-01-272-7/+9
|\ \ \ \ \ | | | | | | | | | | | | SI-7018 Fix memory leak in Attachments
| * | | | | Update a checkfile from a recent fix.Jason Zaugg2013-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The build is currently broken: https://scala-webapps.epfl.ch/jenkins/view/2.10.x/job/scala-nightly-main-2.10.x/
| * | | | | SI-7018 Fix memory leak in Attachments.Jason Zaugg2013-01-271-6/+8
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes NonEmptyAttachments a top level class so that it doesn't accidentally accumulate history via the $outer field. No test is included because I think the fix is self evident.
* | | | | Merge pull request #1983 from paulp/pr/partest-permgenPaul Phillips2013-01-261-3/+4
|\ \ \ \ \ | |_|_|/ / |/| | | | Bumped partest MaxPermSize to 128m.
| * | | | Bumped partest MaxPermSize to 128m.Paul Phillips2013-01-261-3/+4
|/ / / /
* | | | 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 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.
| * | | | | | Set `canRetransform` flag to `false` in instrumentation.Grzegorz Kossakowski2013-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do not need to retransform classes once they are loaded. All instrumentation byte-code is pushed at loading time. This fixes a problem with Java 7 that was failing to add a transformer because we did not declare retransformation capability in `MANIFEST.MF` file in Java agent jar. Java 6 allowed to add transformer due to a bug.
| * | | | | | Correct whitespace in `ASMTransformer.java`.Grzegorz Kossakowski2013-01-241-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's stick to 2 spaces for indentation (and no tabs).
| * | | | | | Fix class loader issues in instrumentation tests.Nada Amin2013-01-241-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ASM ClassWriter uses a wimpy class loader when computing common superclasses. This could cause a ClassNotFoundException in the transform method (at reader.accept). This exception gets swallowed, resulting in a class that should be instrumented to silently not be. The fix is to override getCommonSuperClass to use the correct class loader. Trivia: This bug was discovered while 'stress-testing' this instrumentation scheme on the Coursera students, to check that they implement one method in terms of another in the assignment.
* | | | | | | Merge pull request #1949 from khernyo/partest-scalac-opts-fixPaul Phillips2013-01-243-3/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Use the same default scalac options in all three partest frontends
| * | | | | | | Use the same default scalac options in all three partest frontendsSzabolcs Berecz2013-01-223-3/+2
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make ConsoleRunner, AntRunner and SBTRunner take scalac options from "partest.scalac_opts" property. Also remove leftover "-deprecation" option from test/partest. The change to SBTRunner was not tested as sbt test is currently broken.
* | | | | | | Merge pull request #1952 from retronym/backport/1599Paul Phillips2013-01-243-11/+20
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [backport] Fix SI-6637 (misoptimization in erasure)
| * | | | | | | [backport] Fix SI-6637 (misoptimization in erasure)Jason Zaugg2013-01-233-11/+20
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit f9ef5300ab561628e53c654df9000c75f488d74a Author: Jan Niehusmann <jan@gondor.com> Date: Fri Nov 9 15:05:58 2012 +0100 Fix SI-6637 (misoptimization in erasure) Move the optimization one level deeper so the expression being tested with isInstanceOf is always evaluated. (cherry picked from commit b540aaee4ba30e2dd980456a44e8c6d732222df1)
* | | | | | | Merge pull request #1953 from retronym/backport/1586Paul Phillips2013-01-247-14/+141
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [backport] Fix unsafe array opt. / opt. primitive Array(...)
| * | | | | | | [backport] Fix unsafe array opt. / opt. primitive Array(...)Jason Zaugg2013-01-237-14/+141
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-6611, SI-6247 (partial fix) The original commits on master were a bit circuitous, this is squashed to a neat little package. I had to add type arguments to the Array.apply calls in the test case, they are inferred on master. commit 41ff05dfdbcf032157b3509ace633f2e7a12295c Author: Jason Zaugg <jzaugg@gmail.com> Date: Sun Nov 4 14:44:59 2012 +0100 Refactor guards checking for a particular overload of Array.apply. (cherry picked from commit 092345a24c22a821204fb358d33272ae8f7353be) commit 1e5c942deccaf64f8d57bd8891b912381d7f220a Author: Jason Zaugg <jzaugg@gmail.com> Date: Sun Nov 4 14:17:25 2012 +0100 Expand optimization of Array(e1, ..., en) to primitive arrays. (cherry picked from commit 8265175ecc42293997d59049f430396c77a2b891) commit ab1bf77e39f2dfeacf3fc107ccb2907a1867f04c Author: Jason Zaugg <jzaugg@gmail.com> Date: Sat Nov 3 13:34:20 2012 +0100 SI-6611 Tighten up an unsafe array optimization The net was cast too wide and was unsafely optimizing away array copies. (cherry picked from commit dad886659faca4fba2d4937c9bc6780591b02c27) And also: Optimize primitive Array(e1, ..., en) Expands an existing optimization for reference arrays to apply to primitives, as well. Fixes one aspect of SI-6247. (cherry picked from commit cac5a08611f9511ba4d94b99db630404efae190a) Conflicts: src/compiler/scala/tools/nsc/transform/CleanUp.scala More principled tree copying. Canonical > home-spun. Conflicts: src/compiler/scala/tools/nsc/transform/CleanUp.scala
* | | | | | | Merge pull request #1954 from retronym/backport/1565Paul Phillips2013-01-245-5/+35
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [backport] SI-6567 Warning for Option(implicitView(foo))
| * | | | | | | [backport] SI-6567 Warning for Option(implicitView(foo))Jason Zaugg2013-01-235-5/+35
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 284bd754fa5dfc8bc626b0c5ebe85d872dd044cb Author: Jason Zaugg <jzaugg@gmail.com> Date: Sat Nov 3 16:19:46 2012 +0100 SI-6567 Warning for Option(implicitView(foo)) I've seen the reported problem before in the wild. It seems worthy of a special warning, so long as we advocate Option.apply as an alternative to `if (x == null) Some(x) else None`. It is behind -Xlint at the moment, an option that could do with some promotion. (cherry picked from commit 0bcb9e9169146e3f589c6c9f65cc4a5523b78120)
* | | | | | | Merge pull request #1929 from retronym/ticket/6439Paul Phillips2013-01-243-1/+90
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-6439 Avoid spurious REPL warnings about companionship