summaryrefslogtreecommitdiff
path: root/test/files/run
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2923 from retronym/ticket/7825Grzegorz Kossakowski2013-09-112-4/+36
|\ | | | | SI-7825 Consider DEFAULTMETHOD when refchecking concreteness
| * SI-7398 Enable test for Java 8 source parser under Java 8Jason Zaugg2013-09-101-4/+2
| | | | | | | | | | There is no need to skip it as it only depends on our changes to our JavaParser, and not on any bytecode features of Java 8.
| * SI-7825 Consider DEFAULTMETHOD when refchecking concretenessJason Zaugg2013-09-101-0/+34
| | | | | | | | | | | | | | | | | | | | A class should not be required to implement a Java default method. This commit uses `isDeferredNotDefault` in place of `isDeferred` when finding unimplemented methods. The test itself does not depend on Java 8 as we use scalac's Java source parser to set things up.
* | Merge pull request #2866 from retronym/ticket/7269Jason Zaugg2013-09-091-0/+32
|\ \ | | | | | | SI-7269 Rework MapLike#retains to account for desugaring change
| * | SI-7269 Rework MapLike#retains to account for desugaring changeJason Zaugg2013-08-291-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `MapLike#retains` contains a for-comprehension that relied on the strict `filter` by its generator. You can't, in general, iterate a mutable map and remove items in the same pass. Here's the history of the desugaring of: def retain[A, B](thiz: mutable.Map[A, B])(p: (A, B) => Boolean): thiz.type = { thiz.foreach { case (k, v) => if (p(k, v)) thiz -= k } Before regression (c82ecabad6~1): thiz.filter(((check$ifrefutable$1) => check$ifrefutable$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => true case _ => false })).withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); After regression (c82ecabad6, which incorrectly assumed in the parser that no filter is required for isInstanceOf[Tuple2]) thiz.withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); After the reversion of c82ecabad6, v2.10.2 This is also after 365bb2b4e, which uses `withFilter` rather than `filter`. thiz.withFilter(((check$q$1) => check$ifrefutable$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => true case _ => false })).withFilter(((x$1) => x$1: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang })).foreach(((x$2) => x$2: @scala.unchecked match { case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k) })); This commit does the same as `SetLike#retains`, and converts the map to an immutable list before the rest of the operation.
* | | SI-7814 Avoid init cycle between Predef, `package`, ScalaRuntimeJason Zaugg2013-09-051-0/+71
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not every application will force these in a single thread; we have to do our best to avoid cycles between them. The enclosed test was failing every time before the change. This commit breaks the cycle by avoiding computing `tupleNames` in the constructor of `ScalaRuntime`. The new version has the added benefit of including specialized tuple subclasses, which is verified with a unit test for `isTuple`. Are there more of these lurking? It seems likely. I'm more than a little concerned about the way the `ControlThrowable` fires up `scala.SystemProperties` to check whether or not to suppress stack traces; there is already an ugly hack in place: object NoStackTrace { final def noSuppression = _noSuppression // two-stage init to make checkinit happy, // since sys.SystemProperties.noTraceSupression.value // calls back into NoStackTrace.noSuppression final private var _noSuppression = false _noSuppression = sys.SystemProperties.noTraceSupression.value }
* | Merge pull request #2888 from xeno-by/topic/typed-annotatedJason Zaugg2013-09-043-0/+21
|\ \ | | | | | | typedAnnotated no longer emits nulls
| * | typedAnnotated no longer emits nullsEugene Burmako2013-08-293-0/+21
| |/ | | | | | | | | | | Adds a null-check in original synthesis for the result of typedAnnotated. Previously it was possible for the aforementioned result to look like TypeTree(<tpe>) setOriginal Annotated(..., null). Not anymore.
* | SI-7150 Replace scala.reflect.internal.WeakHashSetGrzegorz Kossakowski2013-09-031-0/+174
| | | | | | | | | | | | | | Replaces scala.reflect.internal.WeakHashSet with a version that * extends the mutable.Set trait * doesn't leak WeakReferences * is unit tested
* | Merge pull request #2868 from retronym/ticket/7775Jason Zaugg2013-08-291-0/+17
|\ \ | | | | | | SI-7775 Harden against the shifting sands of System.getProperties
| * | SI-7775 Harden against the shifting sands of System.getPropertiesJason Zaugg2013-08-261-0/+17
| |/ | | | | | | | | | | | | | | | | | | | | | | | | If another thread writes a new system property (which can happen in pretty innocuous code such as `new Date`!), the compiler startup could fail with a `ConcurrentModificationException` as it iterated all bindings in the properties map in search of a boot classpath property for esoteric JVMs. This commit uses `Properties#getStringProperties` to get a snapshot of the keys that isn't backed by the live map, and iterates these instead. That method will also limit us to bindings with String values, which is all that we expect.
* / SI-7779 Account for class name compactification in reflectionJason Zaugg2013-08-231-0/+67
|/ | | | | | | | | | | | | | | We have to assume that the classes we are reflecting on were compiled with the default value for -Xmax-classfile-name (255). With this assumption, we can apply the same name compactification as done in the regular compiler. The REPL is particularly prone to generating long class names with the '$iw' prefixes, so this is an important fix for runtime reflection. Also adds support for getting the runtime class of `O.type` if `O` is a module.
* Merge pull request #2814 from xeno-by/topic/auto-duplicate-expansionsJames Iry2013-08-167-0/+57
|\ | | | | [nomaster] macro expansions are now auto-duplicated
| * [nomaster] macro expansions are now auto-duplicatedEugene Burmako2013-08-147-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix still requires macro developers to be careful about sharing trees by references, because attributed DefTrees will still bring trouble. However this is an improvement, because it doesn't make matters worse and automatically fixes situations similar to one in the test. A much more thorough discussion with a number of open questions left: http://groups.google.com/group/scala-internals/browse_thread/thread/492560d941b315cc Was fixed ages ago in master in one of the paradise backports. Never got to 2.10.x, but it's very useful, so I'm backporting it now.
* | Merge pull request #2809 from xeno-by/ticket/7733James Iry2013-08-133-0/+15
|\ \ | | | | | | SI-7733 reflective packages now more consistent with scalac
| * | [nomaster] SI-7733 reflective packages now more consistent with scalacEugene Burmako2013-08-133-0/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Previously PackageScopes from scala.reflect ignored all classes that had $'s in non-rightmost positions in their names. Unfortunately this behaviour is inconsistent with how scalac does things, and I reconciled this as usual, by pulling corresponding logic into scala-reflect.jar and sharing it between runtime reflection and compiler. This change has seprate pull requests for 2.10.x and 2.11.0. The latter deprecates `scala.tools.nsc.util.ClassPath.isTraitImplementation` whereas the former (which you're looking at right now) does not, because we can't deprecated members in minor releases.
* | Merge pull request #2813 from xeno-by/topic/showrawGrzegorz Kossakowski2013-08-121-1/+1
|\ \ | | | | | | showRaw now prints symbols of def trees
| * | showRaw now prints symbols of def treesEugene Burmako2013-08-101-1/+1
| | | | | | | | | | | | A very useful addition that came in handy when hacking macro annotations
* | | currentRun.compiles now correctly works in toolboxesEugene Burmako2013-08-102-0/+30
| |/ |/| | | | | Another random bug uncovered and extinguished when hacking macro annots.
* | SI-7331 tb.parse returns unpositioned treesDen Shabalin2013-08-086-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit gets rid off code wrapping that was previously used by toolbox to get into correct parsing mode. Instead combination of templateStats/accept(EOF) is used. This is the same solution as the one used in repl and built-in scriptRunner This pull request doesn't attempt to generalize this approach in any way and re-use it all over the place due to the caution of possible accidental compatibility breakage. I plan to do it separately against master. Additionally there are a few more changes that make importers be aware of positions and a test for that (via @jedesah).
* | Merge pull request #2761 from scalamacros/ticket/7510Jason Zaugg2013-08-015-1/+38
|\ \ | | | | | | Assorted toolbox fixes
| * | brings JavaMirrors up to speed with ClassfileParserEugene Burmako2013-07-235-1/+38
| | | | | | | | | | | | | | | | | | | | | Apparently there are still discrepancies between how the vanilla compiler turns class files into symbols and how the reflective compiler does it. Working on bringing these guys in sync, one bug at a time.
* | | Merge pull request #2750 from retronym/ticket/7455-2.10.xGrzegorz Kossakowski2013-07-273-0/+65
|\ \ \ | |_|/ |/| | SI-7455 Drop dummy param for synthetic access constructor
| * | SI-7455 Drop dummy param for synthetic access constructorJason Zaugg2013-07-283-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java synthesizes public constructors in private classes to allow access from inner classes. The signature of that synthetic constructor (known as a "access constructor") has a dummy parameter appended to avoid overloading clashes. javac chooses the type "Enclosing$1" for the dummy parameter (called the "access constructor tag") which is either an existing anonymous class or a synthesized class for this purpose. In OpenJDK, this transformation is performed in: langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java (Incidentally, scalac would just emits a byte-code public constructor in this situation, rather than a private constructor / access constructor pair.) Scala parses the signature of the access contructor, and drops the $outer parameter, but retains the dummy parameter. This causes havoc when it tries to parse the bytecode for that anonymous class; the class file parser doesn't have the enclosing type parameters of Vector in scope and crash ensues. In any case, we shouldn't allow user code to see that constructor; it should only be called from within its own compilation unit. This commit drops the dummy parameter from access constructor signatures in class file parsing.
* | | [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-143-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #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-7571 Allow nesting of anonymous classes in value classesJason Zaugg2013-06-191-0/+12
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | [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 #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-031-0/+31
|\ \ \ | |_|/ |/| | 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-311-0/+31
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* / SI-7375 ClassTag for value class aliasesEugene Burmako2013-05-315-0/+45
|/ | | | reifyRuntimeClass now always dealiases its argument prior to processing.
* 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.
* | 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.