summaryrefslogtreecommitdiff
path: root/test/files/pos
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3719 from retronym/ticket/8546Jason Zaugg2014-05-092-0/+50
|\ | | | | SI-8546 Pattern matcher analysis foiled by over-widening
| * SI-8546 Pattern matcher analysis foiled by over-wideningJason Zaugg2014-05-072-0/+50
| | | | | | | | | | | | | | | | | | In the enclosed test, the prefix checkable type `ModuleTypeRef(F2.this, C)` was being inadvertently widened to `ModuleTypeRef(F2[?], C)`. This started after some misguided future-proofing in SI-6771 / 3009916. This commit changes the `dealiasWiden` to a `delias`.
* | Merge pull request #3727 from retronym/ticket/8531Jason Zaugg2014-05-092-0/+29
|\ \ | | | | | | SI-8531 Better space efficiency for patmat analysis
| * | SI-8531 Better space efficiency for patmat analysisJason Zaugg2014-05-082-0/+29
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | By adding logging to `clause`, I found that the majority of calls provide 0 or 1 elements. In SI-7020 / 69557da55, we changed this method to use a `LinkedHashSet` to have deterministic results for clauses with more elements. But I suspect that this contributes to higher memory usage from the pattern matcher. The enclosed test case, carefully whittled down by @oxbowlakes, used to consume an inordinate amount of memory and time. After this patch, it is back to 2.10.4 performance. I have run `neg/t7020.scala` in a loop and it still is deterministic.
* | Merge commit 'b5392a0' into merge/master-to-2.11.xJason Zaugg2014-05-095-0/+26
|\ \
| * \ Merge pull request #3689 from xeno-by/ticket/8523Jason Zaugg2014-05-082-0/+11
| |\ \ | | | | | | | | makes bundles friendly to -Ywarn-dead-code
| | * | makes bundles friendly to -Ywarn-dead-codeEugene Burmako2014-04-212-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently, the `new Bundle(???).impl` synthetic tree generated as a macro impl ref for bundles evokes -Ywarn-dead-code warnings. This pull requests changes `???` to `null` in order not to stress out the checker. What's in the argument doesn't actually make any difference anyway.
| * | | Merge pull request #3703 from huitseeker/issue/SI-8537Jason Zaugg2014-05-072-0/+6
| |\ \ \ | | | | | | | | | | SI-8537 Puts SI-8157 fix under Xsource
| | * | | SI-8537 Puts SI-8157 fix under XsourceFrançois Garillot2014-04-252-0/+6
| | | |/ | | |/|
| * / | SI-8325 Accept infix star type outside patternsSom Snytt2014-05-051-0/+9
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up to SI-5702 which enabled use of `*` in infix notation in patterns. Most of the work is in distinguishing infix from a sequence pattern. Also, do not take backticked star as the repeated parameter marker in postfix position. That is, `Int``*``` is not `Int*` -- I hope double-tick renders as tick. There is not a special use case except that backticks mean "I am an identifier, as is, and not a keyword."
* / / Respect -Dpartest.scalac_opts when running the test suite through ANTLukas Rytz2014-05-071-0/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Used to enable `-Xcheckinit` (now also `-Ybackend:GenBCode`) when compiling tests in the respective jenkins builds. This is currently broken, as you can see in [recent build logs] [1], `-Xcheckinit` is missing: [partest] Scalac options are: -optimise Adds `.flags` files for macro tests (correct range positions not enforced) and for tests failing due to SI-8560 or SI-8562. [1]: https://scala-webapps.epfl.ch/jenkins/view/nightlies/job/scala-nightly-checkinit/2058/consoleFull
* | Merge pull request #3635 from retronym/ticket/8329Jason Zaugg2014-04-211-0/+29
|\ \ | |/ |/| SI-8329 Better hygiene for patmat partial functions
| * SI-8329 Better hygiene for patmat partial functionsJason Zaugg2014-03-151-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't enter synthetic parameters of `applyOrElse` et al into scope when typechecking the user-code; instead reference those symbolically. There is an exception to this principle. Currently we allow: val x: PartialFunction[A, B] = x => x match { ... } For this pattern of code, we use the given name `x` for the corresponding method parameter of `applyOrElse` and `isDefinedAt` and we actually need this to be in scope when we typecheck the scrutinee. This construct is tested in `run/virtpatmat_partial.scala`. A new parameter, `paramSynthetic`, differentiates this case from the more typical `val x: PF[A, B] = { case ... => ... ; ... } case, which uses a fresh name need not be in scope. (We could get away with it, as it is fresh, but I thought it better to exclude it.)
* | SI-8497 Fix regression in pickling of AnnotatedTypesJason Zaugg2014-04-142-0/+14
| | | | | | | | | | | | | | | | | | | | Fixes an inconsistency introduced in these two spots: https://github.com/scala/scala/pull/3033/files#diff-6ce1a17ebee31068f41c36a8a2b3bc9aR79 https://github.com/scala/scala/pull/3033/files#diff-c455cb229f5227b1bcaa1544478fe3acR452 The bug shows up when pickling then unpickling an AnnotatedType that has only non-static annotations.
* | SI-8460 Fix regression in divergent implicit recoveryJason Zaugg2014-03-311-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit search detects likely cycles by looking at the stack of open implicits and checking the same implicit appears twice, and if the second occurrence is trying satisfy an implicit search for a "dominant" type. Originally, this condition immediately failed the entire implicit search. However, since Scala 2.10, this mechanism has been refined to continue searching after the first divergent implicit is detected. If a second divergence is found, we fail immediately. If the followup search fails, we report the first divergence. Otherwise, we take the successful result. This mechanism was originally built around exceptions. This proved to be fragile, and was refactored in SI-7291 / accaa314 to instead use the `Context.errors` to control the process. But, since that change, the pattern of implicits in scalanlp/breeze and Shapeless have been prone to reporting the divergent implicit errors where they used to recover. So long as we left the `DivergentImplictTypeError` that originates from a nested implicit search in `context.errors`, we are unable to successfully typecheck other candidates. This commit instead stashes the first such error away in `DivergentImplicitRecovery`, to clear the way for the alternative path to succeed. We must retain any other divergent implicit errors, as witnessed by test/files/neg/t2031.scala, which loops unless we retain divergent implicit errors that we don't stash in `DivergentImplicitRecovery`.
* | SI-8411 match desugared partial functionsDenys Shabalin2014-03-222-0/+14
| |
* | SI-8403 Fix regression in name binding with imports in templatesJason Zaugg2014-03-131-0/+9
|/ | | | | | | | | | | | | | Regressed in dbd8457 which changed `Context#make` to automatically include the imports from the given `Tree` if it was an `Import` tree, rather than requiring callers to call `makeNewImport`. However, this turns out to double up the imports for the "inner" namer of a template that starts with imports. The inner namer has a new scope, but the same owner and tree as its parent. This commit detects this case by seeing if the `Import` tree used to consruct the child context is the same as the parent context. If that is the case, we don't augment `Context#imports`.
* Merge pull request #3615 from retronym/ticket/8376Adriaan Moors2014-03-122-0/+23
|\ | | | | SI-8376 Fix overload resolution with Java varargs
| * SI-8376 Fix overload resolution with Java varargsJason Zaugg2014-03-102-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When comparing specificity of two vararg `MethodTypes`, `isAsSpecific` gets to: ``` case mt @ MethodType(_, _) if bothAreVarargs => checkIsApplicable(mt.paramTypes mapConserve repeatedToSingle) ``` The formal parameter type of a Java varargs parameter is represented as `tq"${defintions.JavaRepeatedParamClass}[$elemTp]"`. For a Scala repeated parameter, we instead use `defintions.RepeatedParamClass`. `bothAreVarargs` detects `JavaRepeatedParamClass`, by virtue of: ``` def isRepeatedParamType(tp: Type) = isScalaRepeatedParamType(tp) || isJavaRepeatedParamType(tp) ``` But, `repeatedToSingle` only considers `RepeatedParamClass`. This bug was ostensibly masked in 2.10.3, but became apparent after a not-quite-refactoring in 0fe56b9770. It would be good to pin that change down to a particular line, but I haven't managed that yet.
* | Merge pull request #3616 from retronym/ticket/8363Adriaan Moors2014-03-112-0/+8
|\ \ | | | | | | SI-8363 Disable -Ydelambdafy:method in constructor position
| * | SI-8363 Disable -Ydelambdafy:method in constructor positionJason Zaugg2014-03-102-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | As @magarciaEPFL has done in his experimental optimizer [1], we can avoid running into limitations of lambdalift (either `VerifyError`s, ala SI-6666, or compiler crashes, such as this bug), by using the old style of "inline" lambda translation when in a super- or self- construtor call. We might be able to get these working later on, but for now we shouldn't block adoption of `-Ydelamndafy:method` for this corner case. [1] https://github.com/magarciaEPFL/scala/blob/GenRefactored99sZ/src/compiler/scala/tools/nsc/transform/UnCurry.scala#L227
* | Merge pull request #3607 from xeno-by/ticket/8367Adriaan Moors2014-03-101-0/+11
|\ \ | |/ |/| SI-8367 revert SI-8192's change to primaryConstructor when isJavaDefined
| * SI-8367 revert SI-8192's change to primaryConstructor when isJavaDefinedAdriaan Moors2014-03-071-0/+11
| | | | | | | | this is some weird stuff
* | Merge pull request #3603 from xeno-by/ticket/8364Jason Zaugg2014-03-102-0/+12
|\ \ | | | | | | SI-8364 fixes cxTree lookup for imports
| * | SI-8364 fixes cxTree lookup for importsEugene Burmako2014-03-072-0/+12
| |/ | | | | | | | | | | | | | | | | This is reminiscent of the bug that I recently fixed in paradise: https://github.com/scalamacros/paradise/commit/0dc4e35883d357b7cbcdfd83b5b4821c1dcc0bb1. When doing something non-standard with contexts, we usually have to keep in mind that new contexts are created not only for trees that demarcate blocks of code, but also for imports.
* / SI-8369 resetAttrs now correctly accounts for skolemsEugene Burmako2014-03-074-0/+23
|/ | | | | resetAttrs (née resetLocalAttrs) has been oblivious to existence of skolems. Not anymore, which prevents us from reverting to the untyper nightmare.
* test case that verifies SI-8352Eugene Burmako2014-02-273-0/+12
|
* SI-8240 Consider rolling back optimizations for ListRex Kerr2014-02-252-0/+22
| | | | | | | | | | | | | | | Some compiler-specific optimizations turn out to be very helpful for Lists in general. * List map can be a lot faster (up to 5x!) * List collect can be considerably faster (up to 3x) * List flatMap can be a bit faster (2x) * List take can be slightly faster (1.1x) and have better structural sharing These appear to be unqualified wins (tested), even in a scenario with mixed collections. This is expected: detecting the builder is faster than the otherwise mandatory object creation, and multiple dispatch is mostly a wash since it was already multiple dispatch in getting to the builder. With -optimize, map is not always such a big win, but is never slower. Also added @noinline to map to work around an optimizer bug (SI-8334) and added a test to check that the pattern that triggers the optimizer bug does not affect any of the map-like methods.
* SI-8324 fix permutation in test filenameAdriaan Moors2014-02-231-0/+0
|
* Merge pull request #3573 from retronym/ticket/8324Grzegorz Kossakowski2014-02-221-0/+16
|\ | | | | SI-8324 Fix regression in override checks for sealed classes
| * SI-8324 Fix regression in override checks for sealed classesJason Zaugg2014-02-221-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | adeffda25 changed `Symbol#isEffectivelyFinal` to help the optimizer by inferring finality within sealed class hierarchies. However, this change wasn't neccesarily welcome for other clients of that method. In the enclosed test case, we see that overriding checks in `RefChecks` regressed. This commit moves the enhanced version into a new method and selectively uses it in the optimizer (and the tail call optimizer).
* | Merge pull request #3567 from retronym/ticket/8315Jason Zaugg2014-02-224-0/+25
|\ \ | |/ |/| SI-8315 Fix crash in dead code elimination
| * SI-8315 Fix crash in dead code eliminationJason Zaugg2014-02-204-0/+25
| | | | | | | | | | | | | | It was a cache invalidation bug. We need to mark the Code as touched to invalidate the caches behind `predecessors` and `successors`.
* | Merge pull request #3557 from adriaanm/t8224Jason Zaugg2014-02-211-0/+12
|\ \ | | | | | | SI-8224 Fix regression in f-bound aware LUBs
| * | SI-8224 Fix regression in f-bound aware LUBsJason Zaugg2014-02-181-0/+12
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable the heuristic approach to recursive bounds unless the compiler is running under `-Xstrict-inference`. [the above was not authored by the original author] In db46c71e88, steps were taken to avoid blowing up in the pathological LUB calculation needed for: def trav = List(List(), Stream()) This skipped a level in the base class sequence when f-bounds were detected at the current level. In that example, when `lublist` was about to: mergePrefixAndArgs( typeOf[LinearSeqOptimized[A, List[A]]], typeOf[LinearSeqOptimized[A, Stream[A]]], ) If it proceeded (as in 2.10.3), the LUB is invalid: error: type arguments [B[_ >: D with C <: B[_ >: D with C <: A]],s.c.immutable.LinearSeq[B[_ >: D with C <: A]] with s.c.AbstractSeq[B[_ >: D with C <: A]] with s.c.LinearSeqOptimized[B[_ >: D with C <: A],s.c.immutable.LinearSeq[A] with s.c.AbstractSeq[A] with s.c.LinearSeqOptimized[A,Immutable with Equals with java.io.Serializable] with java.io.Serializable] with java.io.Serializable] do not conform to trait LinearSeqOptimized's type parameter bounds [+A,+Repr <: s.c.LinearSeqOptimized[A,Repr]] To avoid this, the added code would skip to the first non-F-bounded base type of the same arity of each element in the list. This would get to: LinearSeqLike[D, Stream[D]] LinearSeqLike[C, List[C]] which are lubbable without violating the type constraints. I don't think this was the right remedy. For starters, as seen in this bug report, SI-8224, if the list of types are identical we have let a perfectly good lub slip through our fingers, and end up calculating too general a type. More generally, if the type arguments in f-bounded positions coincide, we don't risk calculating a ill-bounded LUB. Furthermore, the code was widening each of the types separately; this isn't something we want to do within `if (isUniformFrontier)`. AFAICT this was just wasteful and as all `ts0` start with the same type symbol, so `typeConstructorList` should be uniform. This commit restricts this base-class skipping to situations where the argument inferred for an type argument that is used as an f-bound is not: a) an existential (as created by `mergePrefixAndArgs` in invariant positions.), or b) equivalent to one of the corresponding input type arguments (this is the case that fixes the regression in pos/8224.scala)
* | Merge pull request #3555 from adriaanm/rebase-3553Jason Zaugg2014-02-211-0/+8
|\ \ | | | | | | Small Predef cleanup
| * | SI-7788 Avoid accidental shadowing of Predef.conformsAdriaan Moors2014-02-181-0/+8
| |/ | | | | | | | | | | | | Rename `conforms` to `$conforms` and put in a minimal backstop: pos/t7788.scala TODO: predicate the backwards compatibility shim for `Predef_conforms` on `-Xsource:2.10`
* | SI-6675 deprecation warning for auto-tupling in patternsAdriaan Moors2014-02-191-1/+1
| | | | | | | | | | NOTE: when the deprecation warning becomes an error, SI-6111 must become a `won't fix`
* | SI-8306: handle SWITCH nodes with just default caseGrzegorz Kossakowski2014-02-192-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Handle properly SWITCH nodes that contain just a default case in optimizer (ConstantOptimization). SWITCH with just default case is expressed as a node with empty tags and exactly one label. We can handle such nodes easily by introducing a shortcut in logic that computes reachableLabels. Add a test case which triggers patmat to generate SWITCH node with just a default case. Fixes SI-8306.
* | Merge pull request #3452 from xeno-by/topic/palladium0Jason Zaugg2014-02-1920-10/+708
|\ \ | |/ |/| SI-8063 and its seventy friends
| * makes sure compat._ provides full compatibility with 2.10.xEugene Burmako2014-02-188-0/+587
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is extremely important to enable cross-versioning Scala 2.10 codebases against Scala 2.11 using Jason's trick with: // TODO 2.11 Remove this after dropping 2.10.x support. private object HasCompat { val compat = ??? }; import HasCompat._ def impl(c: Context)(...): ... = { import c.universe._ import compat._ ... }
| * tests for SI-8300Eugene Burmako2014-02-185-0/+102
| | | | | | | | | | | | Highlights the dilemma with rich type members in the cake that no longer exists. One used to have to choose between overloading or patmat/extmeth friendliness, but couldn't have both. Thanks to retronym we can have it all.
| * Merge remote-tracking branch 'retronym/topic/8301' into topic/palladium0Eugene Burmako2014-02-182-0/+55
| |\
| * \ Merge remote-tracking branch 'origin/master' into topic/palladium0Eugene Burmako2014-02-167-0/+42
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/reflect/macros/compiler/Resolvers.scala src/compiler/scala/reflect/macros/contexts/Typers.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/api/BuildUtils.scala
| * | | some renamingsEugene Burmako2014-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It’s almost 1am, so I’m only scratching the surface, mechanistically applying the renames that I’ve written down in my notebook: * typeSignature => info * declarations => decls * nme/tpnme => termNames/typeNames * paramss => paramLists * allOverriddenSymbols => overrides Some explanation is in order so that I don’t get crucified :) 1) No information loss happens when abbreviating `typeSignature` and `declarations`. We already have contractions in a number of our public APIs (e.g. `typeParams`), and I think it’s fine to shorten words as long as people can understand the shortened versions without a background in scalac. 2) I agree with Simon that `nme` and `tpnme` are cryptic. I think it would be thoughtful of us to provide newcomers with better names. To offset the increase in mouthfulness, I’ve moved `MethodSymbol.isConstructor` to `Symbol.isConstructor`, which covers the most popular use case for nme’s. 3) I also agree that putting `paramss` is a lot to ask of our users. The double-“s” convention is very neat, but let’s admit that it’s just weird for the newcomers. I think `paramLists` is a good compromise here. 4) `allOverriddenSymbols` is my personal complaint. I think it’s a mouthful and a shorter name would be a much better fit for the public API.
| * | | establishes scala.reflect.api#internalEugene Burmako2014-02-143-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reflection API exhibits a tension inherent to experimental things: on the one hand we want it to grow into a beautiful and robust API, but on the other hand we have to deal with immaturity of underlying mechanisms by providing not very pretty solutions to enable important use cases. In Scala 2.10, which was our first stab at reflection API, we didn't have a systematic approach to dealing with this tension, sometimes exposing too much of internals (e.g. Symbol.deSkolemize) and sometimes exposing too little (e.g. there's still no facility to change owners, to do typing transformations, etc). This resulted in certain confusion with some internal APIs living among public ones, scaring the newcomers, and some internal APIs only available via casting, which requires intimate knowledge of the compiler and breaks compatibility guarantees. This led to creation of the `internal` API module for the reflection API, which provides advanced APIs necessary for macros that push boundaries of the state of the art, clearly demarcating them from the more or less straightforward rest and providing compatibility guarantees on par with the rest of the reflection API. This commit does break source compatibility with reflection API in 2.10, but the next commit is going to introduce a strategy of dealing with that.
| * | | Merge remote-tracking branch 'origin/master' into topic/palladium0Eugene Burmako2014-02-1433-47/+320
| |\ \ \
| * | | | SI-6931 cleans up the position APIEugene Burmako2014-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have finally overcome my fear of positions and got to cleaning up its public interface. Apparently it isn’t so bad, since there’s a sane core of methods (thanks to whoever wrote the comments to internal#Position): 1) Checks to distinguish offsets, opaque ranges and transparent ranges 2) Essentials that inclide start, point, end and source 3) Factories that create new positions based on existing ones It looks like methods from the 3rd group are exactly what we’ve been looking for in SI-6931, so we have nothing to add in this commit.
| * | | | SI-8187 api#Symbol.name now has precise typeEugene Burmako2014-02-142-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don’t remember why we didn’t have written it as `def name: NameType` in the first place (probably because of path-dependent bugs that were popping up every now and then when we were developing the first version of reflection API), but now there are definitely no obstacles to that.
* | | | | Merge pull request #3545 from retronym/topic/8301Jason Zaugg2014-02-182-0/+55
|\ \ \ \ \ | | |_|_|/ | |/| | | SI-8301 fix regression with refinement subtyping, wildcard type.