summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* [backport] SI-7569 Fix end position in PostfixSelect treeFrançois Garillot2013-07-242-0/+31
| | | | | | | introduced in 5b54681: the end position of Postfix operators should take the operator length into account. review by @som-snytt
* SI-7657 clarifies the "macro overrides method" ruleEugene Burmako2013-07-146-18/+38
| | | | | | | | | | | | | | | Currently we allow macros to override non-abstract methods (in order to provide performance enhancements such as foreach for collections), and we also disallow macros to override abstract methods (otherwise downcasting might lead to AbstractMethodErrors). This patch fixes an oversight in the disallowing rule that prohibited macros from overriding a concrete method if that concrete method itself overrides an abstract method. RefCheck entertains all overriding pairs, not only the immediate ones, so the disallowing rule was triggered. Now macros can override abstract methods if and only if either the base type or the self type contain a matching non-abstract method.
* Merge pull request #2674 from richdougherty/2.10.x-si7336-try2Adriaan Moors2013-07-121-0/+31
|\ | | | | SI-7336 Link flatMapped promises to avoid memory leaks
| * SI-7336 - Link flatMapped promises to avoid memory leaksRich Dougherty2013-07-061-0/+31
| |
* | Merge pull request #2666 from som-snytt/issue/7265-spec-at-leastAdriaan Moors2013-07-121-0/+27
|\ \ | | | | | | SI-7265 General test for spec version
| * | SI-7265 General test for spec versionSom Snytt2013-07-041-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test for isJavaAtLeast uses the specification.version. The method argument must have the form "major.minor". The scaladoc is updated to reflect the new reality and a test is added under junit. Note that this implementation aims to be a simple compromise between the functional and imperative camps, that is, to be free of both closures and while loops. And to elicit no cruft like regexes and wrappers for strings. No doubt even more could be done in this department, but we don't wish to spoil the fun on codegolf.stackexchange.com. However, we might decide to sponsor a new site: codereviewpingpong.com For 2.10.x, javaSpecVersion is provided as a private member. The active test is under `run` and the `junit` test must bide its time in `pending`. For 2.11, the private members can be public and the app test replaced with the unit test.
* | | Merge pull request #2721 from retronym/ticket/7649Adriaan Moors2013-07-122-0/+21
|\ \ \ | | | | | | | | SI-7649 Fix positions for reshaped tag materializers
| * | | SI-7649 Fix positions for reshaped tag materializersJason Zaugg2013-07-112-0/+21
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Calls to `materializeClassTag[T]` are replaced during reification with `implicitly[ClassTag[T]]` in the `reify` macro. This is done to avoid referring to symbols in scala-compiler.jar. Class- and Type-Tag materialization is treated in the same way. This commit positions the replacement trees to avoid triggering assertions under -Yrangepos.
* | | Merge pull request #2689 from scalamacros/ticket/7617Adriaan Moors2013-07-126-0/+49
|\ \ \ | | | | | | | | SI-7617 typedAssign no longer expands lhs
| * | | SI-7617 typedAssign no longer expands lhsEugene Burmako2013-07-096-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes sure that setter and updateDynamic macros work as intended rather than in some cases expanding incorrectly or prematurely. Setter invocations are desugared from assignments of values to getters. If a typecheck of an assignment's lhs yields an invocation of a getter, then the assignment is rewritten into an invocation of a setter. However if a getter is a macro, then it just expands, destroying the prerequisite for desugaring. Therefore we need to disable expansion for the typecheck of an lhs. Similar thing happens to updateDynamic that first desugars a getter invocation into q"$target.updateDynamic($fieldName)" and then expects typedAssign to rewrite the corresponding Assign node into an additional application of a partially applied updateDynamic to a rhs. Here we also need to disable the typecheck of an lhs, because macros cannot be partially applied.
* | | | SI-7638 Superaccessor lookup after specializationVlad Ureche2013-07-081-0/+51
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crash was caused by a symbol lookup to rewire the super calls, done after pickler, but specialization added new traits and new members, thus making the super rewiring impossible. To avoid such problems, this patch moves symbol lookup after specialization, so the changes done by specialization (and miniboxing) become visible to mixin. NOTE: This patch will be followed by a similar patch to master. Review by @adriaanm or @retronym.
* | | Merge pull request #2655 from VladUreche/issue/7344Adriaan Moors2013-06-261-0/+53
|\ \ \ | | | | | | | | SI-7344 Specialize methods in private scopes
| * | | SI-7344 Specialize methods in private scopesVlad Ureche2013-06-251-0/+53
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This performs method specialization inside a scope other than a {class, trait, object}: could be another method or a value. This specialization is much simpler, since there is no need to record the new members in the class signature, their signatures are only visible locally. It works according to the usual logic: - we use normalizeMember to create the specialized symbols - we leave DefDef stubs in the tree that are later filled in by tree duplication and adaptation The solution is limited by SI-7579: since the duplicator loses the sym annotations when duplicating, this expansion and rewiring can only take place in code that has not been subject to duplication. You can see the test case for an example. Review by @dragos, @paulp or @axel22.
* | | Merge pull request #2648 from retronym/ticket/7571Grzegorz Kossakowski2013-06-253-7/+17
|\ \ \ | | | | | | | | SI-7571 Allow nesting of anonymous classes in value classes
| * | | SI-7571 Allow nesting of anonymous classes in value classesJason Zaugg2013-06-193-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5d9cde105e added deep prohibition of nested classes within a value class. This has the undesirable side effect of prohibiting partial functions literals in method bodies of a value class. The intention of that prohibition was to avoid problems in code using Type Tests, such as: class C(val inner: A) extends AnyVal { class D } def foo(a: Any, other: C) = a match { case _ : other.D } Here, the pattern usually checks that `a.$outer == other`. But that is incongruent with the way that `other` is erased to `A`. However, not all nested classes could lead us into this trap. This commit slightly relaxes the restriction to allow anonymous classes, which can't appear in a type test. The test shows that the translation generates working code.
* | | | Merge pull request #2511 from ↵Adriaan Moors2013-06-241-409/+153
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | viktorklang/wip-cleaner-Future-method-implementations-2.10-√ General SIP-14 Future method implementation cleanup
| * | | Refactoring to the scala-concurrent-tck.scalaViktor Klang2013-06-191-409/+153
| | | | | | | | | | | | | | | | | | | | | | | | - there were numerous logical issues with the former implementation - failed assertions may not fail the build - there was a lot of ceremony and noise
* | | | Merge pull request #2651 from VladUreche/issue/7343-2Adriaan Moors2013-06-183-1/+59
|\ \ \ \ | | | | | | | | | | SI-7343 Fixed phase ordering in specialization
| * | | | SI-7343 Fixed phase ordering in specializationVlad Ureche2013-06-123-1/+59
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specialization rewires class parents during info transformation, and the new info then guides the tree changes. But if a symbol is created during duplication, which runs after specialization, its info is not visited and thus the corresponding tree is not specialized. One manifestation is the following: ``` object Test { class Parent[@specialized(Int) T] def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = { class X extends Parent[T]() // even in the specialized variant, the local X class // doesn't extend Parent$mcI$sp, since its symbol has // been created after specialization and was not seen // by specialzation's info transformer. ... } } ``` We can fix this by forcing duplication to take place before specialization. Review by @dragos, @paulp or @axel22.
* | | | Merge pull request #2646 from retronym/topic/duration-relax-2.10.xGrzegorz Kossakowski2013-06-181-2/+3
|\ \ \ \ | |/ / / |/| | | [backport] relax time constraint in duration-tck.scala (for Windows VMs)
| * | | [backport] relax time constraint in duration-tck.scala (for Windows VMs)Roland2013-06-101-2/+3
| | | | | | | | | | | | | | | | (cherry picked from commit 3e0fbc0193f0b6f58dc16dae3824677e9902dc7b)
* | | | [backport] SI-7498 ParTrieMap.foreach no longer crashesAleksandar Prokopec2013-06-091-0/+20
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the `split` method of the `ParTrieMap` iterator threw an exception when splitting a splitter that iterated over nodes whose hash codes collide. This was due to reusing the iterator of the list of colliding keys rather than creating a new splitter. This commit changes the `subdivide` method to create a new iterator using the factory method of the current trie map iterator rather than returning a `LinearSeqLike` iterator.
* | | Merge pull request #2616 from retronym/ticket/7505Jason Zaugg2013-06-091-0/+16
|\ \ \ | | | | | | | | SI-7505 Test case for pattern matcher + type alias bug
| * | | SI-7505 Test case for pattern matcher + type alias bugJason Zaugg2013-06-081-0/+16
| | | | | | | | | | | | | | | | Progressed along with SI-7214 in acd74cae09.
* | | | Merge pull request #2606 from JamesIry/2.10.x_classfile_52Jason Zaugg2013-06-094-11/+87
|\ \ \ \ | | | | | | | | | | Test for reading JDK 8 (classfile format 52) class files.
| * | | | Refactor testing logic for only running under certain JDK versionsJames Iry2013-06-043-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had several tests designed to only run if the JDK version was at least some specified version. This commit refactors that common logic into DirectTest.
| * | | | Test for reading JDK 8 (classfile format 52) class files.James Iry2013-05-292-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit includes a test for reading JDK 8 (classfile format 52) class files, in particular default (aka defender) methods. It uses ASM to generate an interface with default methods then exercises that interface from Scala. Surprisingly no changes are necessary to the Scala code base to support reading format 52 class files. Because the test can only run under JDK 8, the JDK version is checked and the expected output is synthesized for previous versions.
* | | | | Merge pull request #2611 from retronym/ticket/6481Paul Phillips2013-06-082-0/+17
|\ \ \ \ \ | | | | | | | | | | | | SI-6841 Fix bug at the intersection of DelayedInit and named args
| * | | | | SI-6841 Fix bug at the intersection of DelayedInit and named argsJason Zaugg2013-05-302-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DelayedInit transformation analyses the constructor to partition regular initialization from calls to super constructors / trait initializers. It failed to find such super calls if they were nested in a Block, which can happens when using named or default arguments. This commit makes that code peer into Blocks to correctly partition the constructor statements. This change doesn't affect the result of run/t4680.scala, which was mentioned in nearby comments and which chronicles bugs with DelayedInit when used in inheritance hierarchies.
* | | | | | Merge pull request #2629 from retronym/ticket/7558Paul Phillips2013-06-081-0/+9
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-7558 Fix capture of free local vars in toolbox compiler
| * | | | | SI-7558 Fix capture of free local vars in toolbox compilerJason Zaugg2013-06-051-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was creating an `ObjectRef[<notype>]` because of a small bug in `capturedVariableType`.
* | | | | | Merge pull request #2626 from retronym/ticket/7556Adriaan Moors2013-06-053-0/+3015
|\ \ \ \ \ \ | |/ / / / / |/| | | | | SI-7556 Fix runtime reflection involving ScalaLongSignature
| * | | | | SI-7556 Fix runtime reflection involving ScalaLongSignatureJason Zaugg2013-06-053-0/+3015
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scala type information is stored in classfiles in encoded in a String in the ScalaSignature annotation. When it is too big for a single String, it is split into an array of Strings in a different annotation, ScalaLongSignature. The enclosed test, with a class containing 3000 methods, uses the latter. It exposes a bug in the way runtime reflection decodes that data. It must concatentate and *then* decode, rather that the other way around.
* | | | | Merge pull request #2609 from retronym/ticket/7507Paul Phillips2013-06-033-0/+42
|\ \ \ \ \ | |_|_|_|/ |/| | | | SI-7507 Fix lookup of private[this] member in presence of self type.
| * | | | SI-7507 Fix lookup of private[this] member in presence of self type.Jason Zaugg2013-05-313-0/+42
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following code: trait Cake extends Slice trait Slice { self: Cake => // must have self type that extends `Slice` private[this] val bippy = () // must be private[this] locally(bippy) } `ThisType(<Slice>)`.findMember(bippy)` excluded the private local member on the grounds that the first class in the base type sequence, `Cake`, was not contained in `Slice`. scala> val thisType = typeOf[Slice].typeSymbol.thisType thisType: $r.intp.global.Type = Slice.this.type scala> thisType.baseClasses res6: List[$r.intp.global.Symbol] = List(trait Cake, trait Slice, class Object, class Any) This commit changes `findMember` to use the symbol of the `ThisType`, rather than the first base class, as the location of the selection.
* | | | Merge pull request #2619 from scalamacros/ticket/7375Eugene Burmako2013-06-025-0/+45
|\ \ \ \ | |/ / / |/| | | SI-7375 ClassTag for value class aliases
| * | | SI-7375 ClassTag for value class aliasesEugene Burmako2013-05-315-0/+45
| |/ / | | | | | | | | | reifyRuntimeClass now always dealiases its argument prior to processing.
* | | Merge pull request #2578 from retronym/ticket/6138Adriaan Moors2013-05-292-0/+12
|\ \ \ | |/ / |/| | SI-6138 Centralize and refine detection of `getClass` calls
| * | SI-6138 Centralize and refine detection of `getClass` callsJason Zaugg2013-05-232-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `getClass` is special cased in the compiler; this is described in in the comments on `Definitions.Any_getClass`. Part of this happens in `Typer#stabilize`. This was trying to determine if an Ident or Select node was a call to `getClass` by merits of the name of the tree's symbol and by checking that the its type (if it was a MethodType or PolyType) had no parameters in the primary parameter list. Overloaded user defined `getClass` methods confused this check. In the enclosed test case, the tree `definitions.this.getClass` had an `OverloadedType`, and such types always report an empty list of `params`. This commit: - changes `stabilize` to use `isGetClass`, rather than the homebrew check - changes `isGetClass` to consider a `Set[Symbol]` containing all `getClass` variants. This moves some similar code from `Erasure` to `Definitions` - keeps a fast negative path in `isGetClass` based on the symbol's name
* | | Merge pull request #2583 from som-snytt/issue/7473-pointless-for-crashPaul Phillips2013-05-272-0/+14
|\ \ \ | | | | | | | | SI-7473 Bad for expr crashes postfix
| * | | SI-7473 Bad for expr crashes postfixSom Snytt2013-05-232-0/+14
| |/ / | | | | | | | | | | | | | | | This commit makes building PostfixSelect robust against a bad pos on its operand, which can happen if a bad for expression results in an EmptyTree.
* / / A test case for a recent LUB progression.Jason Zaugg2013-05-271-0/+34
|/ / | | | | | | | | | | | | | | | | | | | | A test distilled from a Lift example that compiles correctly under 2.10.1, but not under 2.10.0. I pinpointed the progression to: https://github.com/scala/scala/commit/a06d31f6#L0R6611 Chalk up another win for `dealiasWiden`.
* | Merge pull request #2506 from scalamacros/ticket/7461Eugene Burmako2013-05-203-0/+16
|\ \ | | | | | | c.typeCheck(silent = true) now suppresses ambiguous errors
| * | c.typeCheck(silent = true) now suppresses ambiguous errorsEugene Burmako2013-05-093-0/+16
| | | | | | | | | | | | | | | | | | Otherwise use cases like the one shown in the attached test (trying to typecheck something, which leads to an ambiguous overload error) will mysteriously fail compilation.
* | | Merge pull request #2536 from adriaanm/ticket-7359Adriaan Moors2013-05-175-75/+21
|\ \ \ | | | | | | | | [backport #1727] SI-7359 cyclic nested java class
| * | | [backport #1727] SI-7359 cyclic nested java classAdriaan Moors2013-05-165-75/+21
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original commit message (from 54a84a36d5): SI-6548 reflection correctly enters jinners When completing Java classes, runtime reflection enumerates their fields, methods, constructors and inner classes, loads them and enters them into either the instance part (ClassSymbol) or the static part (ModuleSymbol). However unlike fields, methods and constructors, inner classes don't need to be entered explicitly - they are entered implicitly when being loaded. This patch fixes the double-enter problem, make sure that enter-on-load uses the correct owner, and also hardens jclassAsScala against double enters that can occur in a different scenario.
* | | SI-7486 regression in implicit resolution.Paul Phillips2013-05-171-0/+8
| | | | | | | | | | | | What a touchy beast the compiler is.
* | | Merge pull request #2504 from scalamacros/ticket/7464Jason Zaugg2013-05-172-10/+4
|\ \ \ | | | | | | | | SI-7464 allows FieldMirror.set to update vals
| * | | SI-7464 allows FieldMirror.set to update valsEugene Burmako2013-05-172-10/+4
| | | | | | | | | | | | | | | | | | | | There's no reason to leave such sentinels in place inside a facility designed to circumvent usual restrictions of static types / visibility.
* | | | Merge pull request #2497 from scalamacros/topic/macro-qqqJason Zaugg2013-05-174-0/+33
|\ \ \ \ | | | | | | | | | | easy way of writing not implemented macros