summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* macroExpandApply => macroExpandEugene Burmako2013-12-302-2/+2
| | | | | | | | | | Back then, when we needed separate macro expanders for both applications and unapplications, it made sense to have two different methods that do macro expansions. However, after @paulp’s upgrade of the pattern matching engine, we no longer need a dedicated expander for unapply, so I’m removing it and renaming `macroExpandApply` to just `macroExpand`.
* Merge pull request #3288 from xeno-by/topic/f-interpolatorJason Zaugg2013-12-3013-11/+34
|\ | | | | makes boxity of fast track macros configurable
| * makes boxity of fast track macros configurableEugene Burmako2013-12-1913-11/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, all built-in macros were assumed to be whitebox, but that’s actually not the case. Just quasiquote macros have to be whitebox, while the rest can be blackbox. This also fixes SI-8091, because blackbox macros are typechecked differently and therefore the necessary implicit conversion kicks in. If `f”...”` were to remain a whitebox macro, then due to the changes introduced in commit https://github.com/scala/scala/commit/a3b33419b02cafb7e2c6fed6dd96151859fc7d77 we would have to explicitly ascribe its expansion as String to achieve the same effect. After I made reify blackbox, several tests had to be changed, because we now explicitly ascribe the expansion with `c.Expr[T]`, which changes `toString`. Also, a number of less obvious corrections had to be applied, because things like `reify(<constant>).splice` have stopped being optimized away due to `reify(<constant>)` no longer having a narrow `c.Expr[<constant>.type]`, making it ineligible for constant folding. Moreover, this change forced me to adjust our approach to positioning blackbox wrappings, because after being changed to blacbox and starting using wrappings, f”...” interpolators used in the compiler started crashing -Yrangepos builds. Now wrapping Typed nodes are assigned with transparent positions.
* | Merge pull request #3314 from xeno-by/topic/rootsJason Zaugg2013-12-301-0/+18
|\ \ | | | | | | makes well-known packages and package classes consistent with each other
| * | makes well-known packages and package classes consistent with each otherEugene Burmako2013-12-291-0/+18
| | | | | | | | | | | | | | | | | | As discovered in https://groups.google.com/forum/#!topic/scala-user/RckXE90LoXo, RootClass.sourceModule and EmptyPackageClass.sourceModule used to incorrectly return NoSymbol instead of RootModule and EmptyPackage. This is now fixed.
* | | Merge pull request #3309 from xeno-by/topic/expand-dynamicJason Zaugg2013-12-307-0/+60
|\ \ \ | | | | | | | | SI-7777 SI-8006 assorted fixes for dynamics
| * | | SI-8006 prevents infinite applyDynamicNamed desugaringsEugene Burmako2013-12-284-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since mkInvoke, the applyDynamic/selectDynamic/etc desugarer, is disconnected from typedNamedApply, the applyDynamicNamed argument rewriter, the latter doesn’t know whether it needs to apply the rewriting because the application has just been desugared or it needs to hold on because it’s already performed a desugaring on this tree. This commit introduces the attachment that links these translation facilities, preventing infinite applyDynamicNamed desugarings.
| * | | SI-7777 applyDynamic macro fails for nested applicationEugene Burmako2013-12-273-0/+30
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Interplay between the insertApply desugaring and the invokeDynamic desugarings is already quite brittle, but the real fun begins when macros crash the party. The proposed patch enriches the `isDesugaredApply` check performed in `mkInvoke`, the invokeDynamic desugarer, and makes sure that everything is safe and sound in the macroland.
* | | Merge pull request #3311 from xeno-by/topic/fine-points-of-whiteboxity-masterEugene Burmako2013-12-286-0/+64
|\ \ \ | | | | | | | | (master) codifies the state of the art wrt SI-8104
| * | | codifies the state of the art wrt SI-8104Eugene Burmako2013-12-286-0/+64
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | As it was discovered in SI-8104, whiteboxity doesn’t apply equally to type parameters and type members of materialized type classes. During implicit search and subsequent type inference, whitebox type parameters are consistently erased to wildcards, whereas whitebox type members sometimes remain as is and get in the way of signature conformance checks.
* / / SI-6355 SI-7059 it is possible to overload applyDynamicEugene Burmako2013-12-287-7/+54
|/ / | | | | | | | | | | | | As our discussion at https://issues.scala-lang.org/browse/SI-6355 shows, it looks like it is possible to overload applyDynamic, even though a straightforward way is closed. This commit codifies the pattern proposed by @paulp and makes sure that it doesn’t break in the future.
* | Merge pull request #3276 from som-snytt/issue/6120-spurious-checkAdriaan Moors2013-12-194-31/+4
|\ \ | | | | | | SI-6120 Suppress extra warnings
| * | SI-6120 Suppress extra warningsSom Snytt2013-12-164-31/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a mere polish for the fix to allow multiple warnings. Sensibility checks in refchecks were shown to be redundant. This commit includes a mild refactor to reduce tabbage, and uses a local var to flag that a warning has already been emitted. It would be better to have the checks return true if warned, to facilitate `nonSensically || unrelatedly`, etc., but that's a lot of `else false`. The check files that were updated with the redundant warnings are reverted.
* | | Merge pull request #3274 from retronym/ticket/8017Grzegorz Kossakowski2013-12-193-0/+44
|\ \ \ | | | | | | | | SI-8017 Value class awareness for -Ydelamdafy:method
| * | | SI-8017 Value class awareness for -Ydelamdafy:methodJason Zaugg2013-12-153-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The delambdafy creates a bridge method which requires adaptation of the result type to the generic `Object`, which is the erased return type of FunctionN. This bridge building reused some code from erasure, now refactored into TypeAdaptingTransformer. But, it was running into problems with: class C(a: Int) extends AnyVal (x: Any) => new C(0) It created (forgive the pseudo quasiquote syntax): class anonfun$ extends Function1[Any, C] { def apply#1(a: Object): Int = 0 <bridge> def apply#2(a: Object): Object = { val result: Int = apply#1(a) ${adapt(Ident("result"), ObjectType)} } } This resulted in primitive boxing, rather than value class boxing. Instead, we need the call to the main apply method to be typed as `ErasedValueClass(C, Int)`, which `adapt` takes as a trigger to perform value class boxing. Finally, we have to run the post-erasure transformer over the adapted tree to eliminate remnants of `ErasedValueClass` from the types of trees.
* | | | SI-5508 Fix crasher with private[this] in nested traitsJason Zaugg2013-12-198-7/+107
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, accessors for private local trait fields are added very late in the game when the `Mixin` tree transformer treats the trait. By contrast, fields with weaker access have accessors created eagerly in `Namers`. // Mixin#addLateInterfaceMembers val getter = member.getter(clazz) if (getter == NoSymbol) addMember(clazz, newGetter(member)) `addMember` mutates the type of the interface to add the getter. (This seems like a pretty poor design: usually if a phase changes types, it should do in an `InfoTransformer`.) However, if an inner class or anonymous function of the trait has been flattened to a spot where it precedes the trait in the enclosing packages info, this code hasn't had a chance to run, and the lookup of the getter crashes as mixins `postTransform` runs over a selection of the not-yet-materialized getter. // Mixin#postTransform case Select(qual, name) if sym.owner.isImplClass && !isStaticOnly(sym) => val iface = toInterface(sym.owner.tpe).typeSymbol val ifaceGetter = sym getter iface This commit ensures that `Flatten` lifts inner classes to a position *after* the enclosing class in the stats of the enclosing package. Bonus fix: SI-7012 (the followup ticket to SI-6231 / SI-2897)
* | | Merge pull request #3236 from xeno-by/topic/wildbox-macrosEugene Burmako2013-12-179-0/+151
|\ \ \ | |_|/ |/| | (2.11.0-M8) whitebox macros are now first typechecked against outerPt
| * | whitebox macros are now first typechecked against outerPtEugene Burmako2013-12-109-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though whitebox macros are supposed to be used to produce expansions that refine advertised return types of their macro definitions, sometimes those more precise types aren’t picked up by the typechecker. It all started with Travis generating structural types with macros and noticing that typer needs an extra nudge in order to make generated members accessible to the outside world. I didn’t understand the mechanism of the phenomenon back then, and after some time I just gave up. Afterwards, when this issue had been brought up again in a different StackOverflow question, we discussed it at reflection meeting, figured out that typedBlock provides some special treatment to anonymous classes, and it became clear that the first macro typecheck (the one that types the expansion against the return type of the corresponding macro def) is at fault here. The thing is that if we have a block that stands for a desugard anonymous class instantiation, and we typecheck it with expected type different from WildcardType, then typer isn’t going to include decls of the anonymous class in the resulting structural type: https://github.com/scala/scala/blob/master/src/compiler/scala/tools/nsc/typechecker/Typers.scala#L2350. I tried to figure it out at https://groups.google.com/forum/#!topic/scala-internals/eXQt-BPm4i8, but couldn’t dispel the mystery, so again I just gave up. But today I had a profound WAT experience that finally tipped the scales. It turns out that if we typecheck an if, providing a suitable pt, then the resulting type of an if is going to be that pt, even though the lub of the branch types might be more precise. I’m sure that reasons for this behavior are also beyond my understanding, so I decided to sidestep this problem. upd. Here’s Jason’s clarification: Doing thing differently would require us to believe that "'Tis better to have lubbed and lost than never to have lubbed at all." But the desire for efficiency trumps such sentimentality. Now expansions of whitebox macros are first typechecked against outerPt, the expected type that comes from the enclosing context, before being typechecked against innerPt, the expected type that comes from the return type of the macro def. This means that now outerPt provides the correct expected type for the initial, most important typecheck, which makes types more precise.
* | | Modularize continuations plugin.Adriaan Moors2013-12-13126-1856/+0
| | | | | | | | | | | | | | | The continuations plugin and library will still ship with 2.11 (albeit unsupported). They now reside at https://github.com/scala/scala-continuations.
* | | Merge pull request #3258 from ↵Adriaan Moors2013-12-132-2/+2
|\ \ \ | | | | | | | | | | | | | | | | jrudolph/w/fix-typo-that-that-occurs-twice-in-error-messages fix typo in error messages
| * | | fix typo in error messagesJohannes Rudolph2013-12-102-2/+2
| |/ /
* | | Merge pull request #3240 from soc/SI-7618Adriaan Moors2013-12-132-33/+7
|\ \ \ | | | | | | | | SI-7618 Remove octal number literals
| * | | SI-7618 Remove octal number literalsSimon Ochsenreither2013-12-092-33/+7
| | | | | | | | | | | | | | | | | | | | | | | | This also fixes a spurious detection of octal literals in floating point literals: Literals like 01.23 are neither deprecated nor planned for removal.
* | | | Merge pull request #3262 from densh/si/8030Adriaan Moors2013-12-135-17/+167
|\ \ \ \ | | | | | | | | | | SI-8030 force symbols on presentation compiler initialization
| * | | | SI-8030 force symbols on presentation compiler initializationDen Shabalin2013-12-125-17/+167
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit forces a number of built-in symbols in presentation compiler to prevent them from being entered during parsing. The property “parsing doesn’t enter new symbols” is tested on a rich source file that contains significant number of variations of Scala syntax.
* | | | Merge pull request #3250 from soc/SI-8059Adriaan Moors2013-12-132-3/+18
|\ \ \ \ | | | | | | | | | | SI-8059 Override immutable.Queue#{+:,:+} for performance
| * | | | SI-8059 Override immutable.Queue#{+:,:+} for performanceSimon Ochsenreither2013-12-112-3/+18
| |/ / / | | | | | | | | | | | | Without those overrides, all elements are unnecessarily copied.
* | | | Merge pull request #3204 from retronym/topic/patmat-classtag-compoundAdriaan Moors2013-12-133-0/+24
|\ \ \ \ | | | | | | | | | | Test case for recently improved unchecked warning
| * | | | Test case for recently improved unchecked warningJason Zaugg2013-12-123-0/+24
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to https://github.com/scala/scala/pull/2848, the enclosed test compiled without warning and printed: true false Features interacting: - implicit class tags to enable type patterns on abstract types - type tests on compound types. I think the unchecked warning is acceptable for now.
* | | | Merge pull request #3214 from retronym/ticket/8024Adriaan Moors2013-12-134-0/+43
|\ \ \ \ | | | | | | | | | | SI-8024 Fix inaccurate message on overloaded ambiguous ident
| * | | | SI-8024 Improve user-level toString of package objectsJason Zaugg2013-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were outputing a the unattractive `package package`; now we opt for `package object pack`. Under `-Ydebug`, we still go to the "accurate" mode of the old `toString` implementation, which differentiates package objects vs package object classes.
| * | | | SI-8024 Fix inaccurate message on overloaded ambiguous identJason Zaugg2013-12-124-5/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Symbol#owner` of an overloaded symbol doesn't necessarily correspond to the owner of any of the alternatives, and as such it shouldn't be used in error message. neg/t8024.scala actually represents a progression since 2.10.3; the ambiguity was not reported. I bisected the change to https://github.com/scala/scala/pull/1554.
| * | | | SI-8024 Pending test case for package object / overloading bugJason Zaugg2013-12-122-0/+20
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error is new in 2.11, but actually seems correct. It appeared in 2.11.0-M4, more specifically, after https://github.com/scala/scala/pull/1554 But, the error message itself is wrong, and suggests that a method symbol has latched itself to an incorrect owner.
* | | | Merge pull request #3263 from retronym/ticket/6780Adriaan Moors2013-12-132-0/+21
|\ \ \ \ | | | | | | | | | | SI-6780 Better handling of cycles in in-scope implicit search
| * | | | SI-6780 Better handling of cycles in in-scope implicit searchJason Zaugg2013-12-112-0/+21
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit searches in the body of implicit members with inferred types were leading to cycles. Before we used to resolve that by saying there were no implicits in scope at all; now we just skip the current context and still include the enclosing implicits. Care is taken not to cache results under these circumstances. This entails reworking `Context#implicitss` so that: - the implicit info cache only contains implicits from the current level. The List[List[_]] is now contructed on demand; - we can detect cycles by setting `implicitsCacheRunId` to -1 during the computation. The outer implicits when we encounter that. - we avoid caching when we hit a cycle or when the owner is uninitialized.
* | | | Merge pull request #3265 from retronym/merge/2.10.x-to-masterAdriaan Moors2013-12-139-58/+218
|\ \ \ \ | | | | | | | | | | Merge 2.10.x to master
| * \ \ \ Merge commit '9cdbe28' into merge/2.10.x-to-masterJason Zaugg2013-12-112-0/+27
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: build.examples.xml build.xml docs/examples/actors/pingpong.scala docs/examples/fors.scala docs/examples/iterators.scala docs/examples/jolib/Ref.scala docs/examples/jolib/parallelOr.scala docs/examples/monads/callccInterpreter.scala docs/examples/monads/directInterpreter.scala docs/examples/monads/errorInterpreter.scala docs/examples/monads/simpleInterpreter.scala docs/examples/monads/stateInterpreter.scala docs/examples/parsing/ArithmeticParser.scala docs/examples/patterns.scala docs/examples/pilib/elasticBuffer.scala docs/examples/pilib/handover.scala docs/examples/pilib/piNat.scala docs/examples/typeinf.scala src/build/pack.xml
| | * \ \ \ Merge pull request #3249 from retronym/ticket/7912Adriaan Moors2013-12-101-0/+16
| | |\ \ \ \ | | | | | | | | | | | | | | SI-7912 Be defensive calling `toString` in `MatchError#getMessage`
| | | * | | | SI-7912 Be defensive calling `toString` in `MatchError#getMessage`Jason Zaugg2013-12-101-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise, objects with exception-throwing `toString` lead to a cascading error far removed from the originally failed match.
| | * | | | | Merge pull request #3251 from retronym/ticket/8060Adriaan Moors2013-12-101-0/+11
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | SI-8060 Avoid infinite loop with higher kinded type alias
| | | * | | | | SI-8060 Avoid infinite loop with higher kinded type aliasJason Zaugg2013-12-101-0/+11
| | | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `dealiasLocals` map was assuming that: tp.isAliasType implies (tp.dealias ne tp) This isn't true if `!typeParamsMatchArgs`. This commit avoids the infinite loop by checking whether or not dealiasing progresses.
| | * | | | | Merge pull request #3248 from adriaanm/dist-cleanup-licensesAdriaan Moors2013-12-102-27/+0
| | |\ \ \ \ \ | | | |/ / / / | | |/| | | | Clean up Scala distribution a bit.
| | | * | | | Remove unused android test and corresponding license.Adriaan Moors2013-12-092-27/+0
| | | | | | |
| * | | | | | Merge commit '0c92704' into merge/2.10.x-to-masterJason Zaugg2013-12-116-58/+169
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bincompat-forward.whitelist.conf src/interactive/scala/tools/nsc/interactive/Global.scala test/files/presentation/scope-completion-2.check test/files/presentation/scope-completion-3.check test/files/presentation/scope-completion-import.check Conflicts in the scope completion tests handled with the help of @skyluc in https://github.com/scala/scala/pull/3264
| | * | | | | Merge pull request #3222 from skyluc/issue/completion-import-vals-210-7995Adriaan Moors2013-12-095-53/+107
| | |\ \ \ \ \ | | | |/ / / / | | |/| | | | SI-7995 completion imported vars and vals
| | | * | | | SI-7995 completion imported vars and valsLuc Bourlier2013-12-065-53/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Imported member vals and vars were always marked inaccessible, even if referencing them at the location of the completion is valid in code. The accessible flag is now set accordingly to the accessibility of the getter.
| | * | | | | Merge pull request #3229 from retronym/ticket/8029Adriaan Moors2013-12-091-0/+57
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | SI-8029 Avoid multi-run cyclic error with companions, package object
| | | * | | | | SI-8029 Avoid multi-run cyclic error with companions, package objectJason Zaugg2013-12-061-0/+57
| | | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug report suggests this problem only became visible in the IDE *after* 2.10.3, but I tested an IDE with exactly 2.10.3 and saw the same problem. In fact, my test case fails as far back as 2.10.0. I suspect the problem showed up after 816cecf9a9, which checks that pairs of companion symbols are codefined eagerly in Namers. This commit modifies the check of `rawInfo ne NoType` in `isCoDefinedWith` to avoid triggering adaptation of types from the previous run. I'm not sure of the precise intent of that check. I looked at c9861cd198 (genesis of isCoDefinedWith). Before that we get back to 3761cb4b3a1 (the dawn of Subversion.)
| | * | | | | Merge pull request #3230 from retronym/backport/7439Eugene Burmako2013-12-074-0/+38
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | [backport] SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.
| | | * | | | | [backport] SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.Jason Zaugg2013-12-074-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `originalInfo` can return null for stub symbols; deal with that as we used to before a regression in 016bc3db. After this change, we can once again delete A_1.class and still compile code instantiating B_1. (A_1 is only referred to in a method signature of B_1 which is not called from our code.) scala> new B_1 warning: Class A_1 not found - continuing with a stub. res0: B_1 = B_1@5284b8f9 In practice, this situation arises when someone uses a third party class that was compiled against other libraries not avaialable on the current compilation classpath. (cherry picked from commit a95432168204964e4f6c4571e781559c1640f2d8)