summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3092 from retronym/ticket/7678-2Grzegorz Kossakowski2013-11-083-0/+72
|\ | | | | Small implicit optimizations, and SI-7678 RunDefinitions
| * SI-7678 Don't cache member symbols of TypeTags in Definitions.Jason Zaugg2013-11-083-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It we can only safely use vals in Definitions for top-level symbols. Otherwise, when the IDE switches to loading the symbol from source, we can hold on to a stale symbol, which in turn impedes implicit materialization of TypeTags. This commit moves (most) of the accessors for member symbols into RunDefinitions, and changes calling code accordingly. This is a win for presentation compiler correctness, and might even shave of a few cycles. In a few cases, I have had to leave a `def` to a member symbol in Definitions so we can get to it from the SymbolTable cake, which doesn't see RunDefinitions. The macro FastTrack facility now correctly recreates the mapping from Symbol to macro implementation each run, using a new facility in perRunCaches to create a run-indexed cache. The enclosed test recreates the situation reported in the ticket, in which TypeTags.scala is loaded from source.
* | Merge pull request #3101 from xeno-by/ticket/7776Eugene Burmako2013-11-072-0/+20
|\ \ | |/ |/| SI-7776 post-erasure signature clashes are now macro-aware
| * SI-7776 post-erasure signature clashes are now macro-awareEugene Burmako2013-11-052-0/+20
| | | | | | | | | | | | | | "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.
* | Merge pull request #3042 from gourlaysama/t7634-repl-sh-is-brokenAdriaan Moors2013-11-072-0/+30
|\ \ | | | | | | SI-7634 resurrect the REPL's :sh command
| * | SI-7634 resurrect the REPL's :sh commandAntoine Gourlay2013-11-062-0/+30
| | | | | | | | | | | | | | | | | | ProcessResult had a companion object in 2.10 that somehow disappeared in 2.11. It only called "new ProcessResult(...)", so the REPL might just as well do that.
* | | Merge pull request #3081 from JamesIry/wip_delayed_delambdafy_cleanupAdriaan Moors2013-11-0748-57/+450
|\ \ \ | | | | | | | | Delay delambdafication and put the lambda's body into the containing class
| * | | Force several tests to run using inline delambdafication.James Iry2013-11-069-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | The differences when running with method based delambdafication aren't important enough yet to create specialized versions that use method based delambdafication.
| * | | Create test variants where delambdafication alters signatures.James Iry2013-11-0610-2/+142
| | | | | | | | | | | | | | | | | | | | | | | | This commit includes several tests where there's a variation in signatures between inline delambdafication and method based delambdafication.
| * | | Make specialization aware of anonymous functions.James Iry2013-11-062-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During development of late delmabdafying there was a problem where specialization would undo some of the work done in uncurry if the body of the lambda had a constant type. That would result in a compiler crash as when the delambdafy phase got a tree shape it didn't understand. This commit has a fix and a test.
| * | | Make GenASM not eliminate loadmodule on static methods.James Iry2013-11-062-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During development of delayed delambdafy there was a problem where GenASM would eliminate a loadmodule for all methods defined within that module even if those methods were static. The result would be broken byte code that failed verification. This commit fixes that and adds a test.
| * | | Flesh out the Delambdafy phase.James Iry2013-11-066-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit puts a real body on the Delambdafy phase. From a lambda, Delambdafy will create 1) a static forwarder at the top level of the class that contained the lambda 2) a new top level class that a) has fields and a constructor taking the captured environment (including possbily the "this" reference) b) an apply method that calls the static forwarder c) if needed a bridge method for the apply method 3) an instantiation of the newly created class which replaces the lambda Trees.scala is modified to add two more convenient factories for templates and classdefs. A few basic tests are included to verify that it works as expected. Further commits will have additional tests.
| * | | Adds a setting to delay delambdafication. If set then uncurry liftsJames Iry2013-11-068-0/+156
| | | | | | | | | | | | | | | | | | | | the body of a lambda into a local def. Tests are included to show the different tree shapes.
| * | | Add a skeletal Delambdafy phase.James Iry2013-11-017-47/+54
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds a do-nothing phase called "Delambdafy" that will eventually be responsible for doing the final translation of lambdas into classes.
| * | | Make future-spec tests not spawn threads in constructors.James Iry2013-11-014-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The future-spec tests were spawning threads in object constructors which meant they were on the ragged edge of entering deadlock from the static initialization lock acquired during the static initialization blocks we use to construct object reference fields. My work on restructuring lambdas pushed it over the edge. This commit refactors the tests to use class constructors rather than object constructors.
* | | | Merge pull request #3086 from axel22/topic/pc-execution-contextAdriaan Moors2013-11-059-64/+114
|\ \ \ \ | |_|_|/ |/| | | - parallel collections should use default ExecutionContext
| * | | SI-7938 - parallel collections should use default ExecutionContextAleksandar Prokopec2013-10-299-64/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parallel collections now use `scala.concurrent.ExecutionContext` by default. The `ExecutionContextTaskSupport` is optimized to use the `ForkJoinPool` underlying the `ExecutionContext` if possible. Otherwise, a fallback `TaskSupport` that creates a reduction tree and execute an operation through `Future`s is used.
* | | | SI-7944 FOUND: stray undetermined type params in vicinity of implicitsJason Zaugg2013-10-311-0/+24
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit search created a nested Context into which the results of its typechecking, namely, errors and undetermined type parameters (roughly: those inferred as Nothing) are stashed. The code the drives the process was checking for errors, but discarded those undetermined type parameters. This commit copies them from the child context to the parent, which lets `Typer#adapt` to get to: else if (hasUndetsInMonoMode) { // (9) assert(!context.inTypeConstructorAllowed, context) //@M instantiatePossiblyExpectingUnit(tree, mode, pt) } Our lost TypeVar has found its way home! The reward for which is being instantiated, based on another type inference session adapting the expression's type to the expected type.
* | | Merge pull request #3076 from soc/SI-7605-deprecate-proceduresJames Iry2013-10-293-0/+18
|\ \ \ | | | | | | | | SI-7605 Deprecate procedure syntax
| * | | SI-7605 Deprecate procedure syntaxSimon Ochsenreither2013-10-243-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit covers three cases: - constructor definitions (def this {...}) - concrete method definitions (def foo {...}) - abstract method declarations (def foo) The deprecation is currently hidden behind -Xfuture pending IDE support for migrating users from procedures to methods.
* | | | Merge pull request #3082 from retronym/ticket/6385Grzegorz Kossakowski2013-10-299-9/+68
|\ \ \ \ | |_|/ / |/| | | SI-6385 Avoid bridges to identical signatures over value classes
| * | | SI-6385 Avoid bridges to identical signatures over value classesJason Zaugg2013-10-289-9/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Paul noted in the comments to SI-6260 (from which I mined some test cases) "there is no possible basis for conflict here": scala> class C[A](val a: Any) extends AnyVal defined class C scala> class B { def x[A](ca: C[A]) = () } defined class B scala> class D extends B { override def x[A](ca: C[A]) = () } <console>:8: error: bridge generated for member method x: [A](ca: C[A])Unit in class D which overrides method x: [A](ca: C[A])Unit in class B clashes with definition of the member itself; both have erased type (ca: Object)Unit class D extends B { override def x[A](ca: C[A]) = () } ^ What was happening? Bridge computation compares `B#x` and `D#x` exitingErasure, which results in comparing: ErasedValueType(C[A(in B#x)]) =:= ErasedValueType(C[A(in D#x)]) These types were considered distinct (on the grounds of the unique type hash consing), even though they have the same erasure and involve the same value class. That triggered creation of an bridge. After post-erasure eliminates the `ErasedValuedType`s, we find that this marvel of enginineering is bridges `(Object)Unit` right back onto itself. The previous resolution of SI-6385 (d435f72e5fb7fe) was a test case that confirmed that we detected the zero-length bridge and reported it nicely, which happened after related work in SI-6260. But we can simply avoid creating in it in the first place. That's what this commit does. It does so by reducing the amount of information carried in `ErasedValueType` to the bare minimum needed during the erasure -> posterasure transition. We need to know: 1. which value class wraps the value, so we can box and unbox as needed 2. the erasure of the underlying value, which will replace this type in post-erasure. This construction means that the bridge above computation now compares: ErasedValueType(C, Any) =:= ErasedValueType(C, Any]) I have included a test to show that: - we don't incur any linkage or other runtime errors in the reported case (run/t6385.scala) - a similar case compiles when the signatures align (pos/t6260a.scala), but does *not* compile when the just erasures align (neg/t6260c.scala) - polymorphic value classes continue to erase to the instantiated type of the unbox: (run/t6260b.scala) - other cases in SI-6260 remains unsolved and indeed unsolvable without an overhaul of value classes: (neg/t6260b.scala) In my travels I spotted a bug in corner case of null, asInstanceOf and value classes, which I have described in a pending test.
* | | | Remove orphaned check files and flags files.Jason Zaugg2013-10-275-16/+0
| | | | | | | | | | | | | | | | (for f in $(find test -name '*.check' -o -name '*.flags'); do bare=$(echo $f | sed -E 's/\.\w+$//'); ([[ -f "$bare" ]] || [[ -d "$bare" ]] || [[ -f "$bare.scala" ]] || [[ -f "$bare.test" ]] || echo $f) done;) | xargs rm
* | | | Remove empty check files and flags files.Jason Zaugg2013-10-2759-0/+0
|/ / / | | | | | | | | | for f in $(find test -name '*.check' -o -name '*.flags'); do [[ $(wc -c $f | sed -E 's/ *([0-9]+).*/\1/') == "0" ]] && rm $f; done
* | | Merge pull request #3073 from retronym/ticket/7928Jason Zaugg2013-10-251-0/+16
|\ \ \ | | | | | | | | Favour module accessors symbols in rebind
| * | | SI-7928 Favour module accessors symbols in rebindJason Zaugg2013-10-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Refchecks tree transformer transforms a nested modules that overrides a method into a pair of symbols: the module itself, and an module accessor that matches the overridden symbol. [[syntax trees at end of typer]] // test1.scala package <empty> { abstract trait C2 extends scala.AnyRef { def O1: Any }; class C1 extends AnyRef with C2 { object O1 extends scala.AnyRef } } [[syntax trees at end of refchecks]] // test1.scala package <empty> { abstract trait C2 extends scala.AnyRef { def O1: Any }; class C1 extends AnyRef with C2 { object O1 extends scala.AnyRef @volatile <synthetic> private[this] var O1$module: C1.this.O1.type = _; <stable> def O1: C1.this.O1.type = { C1.this.O1$module = new C1.this.O1.type(); C1.this.O1$module } } } When constructing a TypeRef or SingleType with a prefix and and a symbol, the factory methods internally use `rebind` to see if the provided symbol should be replaced with an overriding symbol that is available in that prefix. Trying this out in the REPL is a bit misleading, because even if you change phase to `refchecks`, you won't get the desired results because the transform is not done in an InfoTransformer. scala> val O1 = typeOf[C1].decl(TermName("O1")) O1: $r.intp.global.Symbol = object O1 scala> typeRef(typeOf[C2], O1, Nil) res13: $r.intp.global.Type = C2#O1 scala> res13.asInstanceOf[TypeRef].sym.owner res14: $r.intp.global.Symbol = class C1 But debugging the test case, we get into `rebind` during an AsSeenFrom which is where we crashed when `suchThat` encountered the overloaded module and module accessor symbols: typeOf[OuterObject.Inner.type].memberType(symbolOf[InnerTrait.Collection]) ... singleTypeAsSeen(OuterTrait.this.Inner.type) val SingleType(pre, sym) = tp // pre = OuterTrait.this.type // sym = OuterTrait.Inner val pre1 = this(pre) // OuterObject.type singleType(pre1, sym) rebind(pre1, sym) // was crashing, now OuterObject.Inner } This commit excludes the module symbol from symbol lookup in the prefix in rebind.
* | | | Merge pull request #3077 from retronym/topic/phase-descAdriaan Moors2013-10-245-5/+5
|\ \ \ \ | | | | | | | | | | Update description of explicitouter phase.
| * | | | Update description of explicitouter phase.Jason Zaugg2013-10-245-5/+5
| | | | | | | | | | | | | | | | | | | | Patern translation now happens earlier.
* | | | | Merge pull request #3006 from ivmaykov/masterAdriaan Moors2013-10-241-0/+49
|\ \ \ \ \ | |/ / / / |/| | | | SI-7883 - don't iterate over all keys in MapWrapper.containsKey()
| * | | | SI-7883 - don't iterate over all keys in MapWrapper.containsKey()Ilya Maykov2013-10-011-0/+49
| | | | |
* | | | | Merge pull request #3026 from retronym/ticket/3871Jason Zaugg2013-10-234-0/+242
|\ \ \ \ \ | |_|_|/ / |/| | | | Tests for protected access
| * | | | SI-3871 Testing protected access against the specJason Zaugg2013-10-232-0/+224
| | | | | | | | | | | | | | | | | | | | | | | | | I've marked a few minor cases in the test with !!! where I believe the behaviour goes beyond the spec.
| * | | | SI-3871 Missing test case for protected bug.Jason Zaugg2013-10-092-0/+18
| | | | | | | | | | | | | | | | | | | | c39f26382dddaa7 fixed the bug but didn't commit a test case.
* | | | | Merge pull request #3039 from huitseeker/filter-partest-JAVA_OPTIONSJason Zaugg2013-10-231-0/+3
|\ \ \ \ \ | | | | | | | | | | | | Filter JVM debug output for custom options in partest
| * | | | | Filter JVM debug output for custom options in partestFrançois Garillot2013-10-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | The Picked up _JAVA_OPTIONS line occurs on Sun's JDK as a debug output when you use that variable to set up custom VM options
* | | | | | Merge pull request #3059 from densh/pull/si-6840Jason Zaugg2013-10-231-0/+9
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-6840 fixes weird typing of quasiquote arguments
| * | | | | | SI-6840 fixes weird typing of quasiquote argumentsDen Shabalin2013-10-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously quasiquote arguments were type checked against Any which caused weird inference that made splicing of complex expressions unusable: val l1 = List(q"foo") val l2 = List(q"bar") q"f(..${l1 ++ l2})" // argument type checked as Any instead of List[Tree] This is fixed by forcing compiler to type check against type variable which itself isn't used in any other way.
* | | | | | | Merge pull request #3070 from xeno-by/topic/macro-impl-wrong-shapeJason Zaugg2013-10-238-1/+21
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | better macro impl shape errors
| * | | | | | | better macro impl shape errorsEugene Burmako2013-10-238-1/+21
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the advent of quasiquotes, we allowed both arguments and return types of macro impls to be c.Tree's (as opposed to traditional c.Expr[T]'s). This warrants an update of macro def <-> macro impl signature mismatch errors that include a printout of suggested macro impl signatures. Now along with a signature that contains exprs, we suggest another signature that has all exprs replaced by trees
* | | | | | | Merge pull request #3068 from retronym/ticket/7020-3-1Jason Zaugg2013-10-233-4/+4
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Deterministic warnings for pattern matcher, take 2
| * | | | | | | SI-7020 Deterministic warnings for pattern matcher, take 2Jason Zaugg2013-10-223-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous swing at determinism, ebb01e05cbe4, made decent contact but apparently didn't hit it out of the park. The test wavered every hundred or so runs, as witnessed occasionally in nightly builds or pull request validation. I setup a test to run neg/7020.scala a few hundred times, and could trigger the failure reliably. I then swept through the pattern matcher in search of HashMap and HashSet creation, and changed them all to the Linked variety. The results of that are published in retronym#ticket/7020-3 [1]. This commit represents the careful whittling down of that patch to the minimal change required to exhibit determinism. [1] https://github.com/retronym/scala/compare/ticket/7020-3
* | | | | | | | Merge pull request #3060 from harrah/t7519-bJason Zaugg2013-10-233-0/+28
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7519: Additional test case covering sbt/sbt#914
| * | | | | | | | SI-7519: Additional test case covering sbt/sbt#914Mark Harrah2013-10-203-0/+28
| | |/ / / / / / | |/| | | | | |
* | | | | | | | Merge pull request #3057 from xeno-by/topic/fancy-java-classesJason Zaugg2013-10-233-0/+37
|\ \ \ \ \ \ \ \ | |_|_|_|_|_|/ / |/| | | | | | | fixes handling of fancy nested classes in runtime reflection
| * | | | | | | fixes handling of fancy nested classes in runtime reflectionEugene Burmako2013-10-193-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces the `jclazz.isMemberClass` check for whether we have an inner/nested class with `jclazz.getEnclosingClass != null`, because there exist classes produced by javac (see the attached jar file and the test log) which have the following properties: * They are nested within a parent class * getEnclosingClass returns a non-null value * isMemberClass returns false Previously such classes were incorrectly treated as non-nested, were incorrectly put into an enclosing package rather than an enclosing class, and had their names trimmed in the process, leading to situations when a package has multiple declarations with the same name. This is now fixed. When changing the check, we need to be careful with interpretation of what Class.getEnclosingXXX methods return. If getEnclosingClass produces a non-null result, this doesn't mean that the class is inner or nested, because getEnclosingClass is also not null for local classes (the ones with getEnclosingMethod != null || getEnclosingConstructor != null). This is expressed in the order of pattern match clauses in `sOwner`. Now when the bug is fixed, I also revert b18a2f8798b2, restoring a very important integrity check in runtime reflection, which I had to disable a couple hours ago to fix a master breakage. More details at scala-internals: https://groups.google.com/forum/#!topic/scala-internals/hcnUFk75MgQ
* | | | | | | | temporarily disables run/reflection-sync-subtypesEugene Burmako2013-10-232-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test has been a source of spurious failures as in, for example https://github.com/scala/scala/pull/3029#issuecomment-26811129, so I'm disabling it for the time being while I investigate the issue.
* | | | | | | | Merge pull request #3047 from xeno-by/topic/deprecateEugene Burmako2013-10-2253-139/+149
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | deprecates raw tree manipulation facilities in macros.Context
| * | | | | | | changes some manual tree constructions in macro tests to quasiquotesEugene Burmako2013-10-1834-100/+85
| | | | | | | |
| * | | | | | | deprecates raw tree manipulation facilities in macros.ContextEugene Burmako2013-10-1841-89/+114
| | | | | | | |
* | | | | | | | Moving disabled tests to their rightful home.Jason Zaugg2013-10-214-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test/disabled, not test/files/disabled.