summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3178 from retronym/ticket/7872Adriaan Moors2013-11-252-0/+12
|\ | | | | SI-7872 Plug a variance exploit in refinement types
| * SI-7872 Plug a variance exploit in refinement typesJason Zaugg2013-11-232-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refinement types are collapsed to a TypeTree with an original during type checking; this was enough to evade variance validation in refchecks. This commit: - validates the original of `TypeTree`s in refchecks - changes VarianceValidator to recurse into: - the originals of `TypeTree`s - `TypTree` (to cover, e.g. `CompoundTypeTree` / `SelectFromTypeTree`) It also finds an unreported variance violation in an existing test case, variances.scala. This looks to be legitimate.
* | Merge pull request #3183 from xeno-by/topic/pure-expression-does-nothingAdriaan Moors2013-11-251-1/+2
|\ \ | | | | | | SI-8001 spurious "pure expression does nothing" warning
| * | SI-8001 spurious "pure expression does nothing" warningEugene Burmako2013-11-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `isPureExprForWarningPurposes` doesn’t warn on `()`, but `(): Unit` leaves it confused. This patch fixes the problem. The fix is important in the context of the recent split between blackbox and whitebox macros. Macro engines wrap expansions of blackbox macros in type ascriptions, so a macro that expands into `()` would actually produce `(): Unit`, which would trigger a spurious warning. Thanks @milessabin for spotting this problem!
* | | Merge pull request #3130 from retronym/ticket/7967-2Adriaan Moors2013-11-251-2/+3
|\ \ \ | | | | | | | | SI-7967 Account for type aliases in self-type checks
| * | | SI-7967 Account for type aliases in self-type checksJason Zaugg2013-11-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These eluded the check for "illegal inheritance; self-type does not conform" as AliasTypeRef doesn't forward `typeOfThis`. This commit dealiases before calling `typeOfThis`. That seems to be the most localised change. Without the dealias, we had: parent.tpe = TypeRef(pre, sym = AliasTypeSymbol("CC"), Nil) parent.tpe.typeOfThis = parent.tpe.transform(sym.typeOfThis) = CC After: parent.tpe.dealias = TypeRef(pre, sym = ClassSymbol("C"), Nil) parent.tpe.dealias.typeOfThis = C with B
* | | | Merge pull request #3165 from retronym/ticket/uncurry-tidy-2Adriaan Moors2013-11-254-96/+69
|\ \ \ \ | | | | | | | | | | Unifying -Ydelambdafy:{inline, method}
| * | | | Special treatment for local symbols in TypeTreeMemberTypeJason Zaugg2013-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoids calling `thisType` on the owner if it is a term symbol, which doesn't make much sense. This method is used internally in tree factory methods that create, e.g, a `DefDef` based on the info of a `Symbol`.
| * | | | Refactor away duplication between -Ydelambdafy:{inline,method}Jason Zaugg2013-11-232-64/+47
| | | | |
| * | | | Substitute new parameter symbols into lambda bodyJason Zaugg2013-11-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, new synthetic parameter symbols were created for the apply method parameters, but only used in its `MethodType`. The `ValDef` trees of the function, along with their symbols, were used directly as the parameter trees of the apply method. % cat sandbox/test.scala object Test { (x: Int) => { (y: Int) => ??? } } % scalac-hash v2.10.3 -Xprint:typer,uncurry -uniqid ../scala2/sandbox/test.scala | egrep 'syntax|\bx' [info] v2.10.3 => /Users/jason/usr/scala-v2.10.3-0-g88b5d19 [[syntax trees at end of typer]] // test.scala ((x#12152: Int#351) => x#12152)#12151 [[syntax trees at end of uncurry]] // test.scala final def apply#15952(x#12152: Int#351): Int#351 = x#12152 This approach dates back a long way: c64152bc3. @odersky tells me it was most likely due to insufficent substitution/cloning machinery at the time. % qbin/scalac -Xprint:typer,uncurry -uniqid ../scala2/sandbox/test.scala | egrep 'syntax|\bx' [[syntax trees at end of typer]] // test.scala ((x#13685: Int#1760) => x#13685)#13671 [[syntax trees at end of uncurry]] // test.scala final def apply#13959(x#13960: Int#1760): Int#1760 = x#13960 To make this work, I had to fix a problem in symbol substition; this was commited in the previous commit. In the enclosed test, at Uncurry, the symbol of the nested class `N` had a `ClassInfoType`, which listed as a parent `M[a.C]`. When we substituted the new method parameter symbol `a` for the eponymous function parameter symbol, this was not touched.
| * | | | Symbol substutition must consider ClassInfoType#parentsJason Zaugg2013-11-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An upcoming change to uncurry, in which I plan to make substitution of `lambda params -> apply method params` requires that I first to fix a problem in symbol substition. This situation can arise when the body of this definition: def owner1(a: A) = { class C extends M[a.B] } is transplanted into a new owner that has a different symbol for `a`. I speculated that value classes might also be prone to the fact that symbol substitution neglected `ClassInfoType#parents`. We can test change with Value Classes: Partial Functions that are dependent on value class param type used to fail with a spurious overriding error, now they work correctly.
| * | | | Tidy up the Uncurry component of delambdafyJason Zaugg2013-11-172-42/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use tree factories that accept symbols and encapsulate ValDef creation - Use `gen.mkForwarder` to handle the conditional addition of `: _*` for varargs functions. We don't need to predicate this on `etaExpandKeepsStar`; the only place that need to do that is EtaExpansion.
* | | | | Merge pull request #3185 from sschaef/update-eclipse-classpathAdriaan Moors2013-11-222-4/+4
|\ \ \ \ \ | | | | | | | | | | | | Update Eclipse classpath files
| * | | | | Update Eclipse classpath filesSimon Schaefer2013-11-232-4/+4
| | | | | |
* | | | | | Merge pull request #3186 from Blaisorblade/patch-1Adriaan Moors2013-11-221-3/+3
|\ \ \ \ \ \ | | | | | | | | | | | | | | Revise paragraph (a revised #3164)
| * | | | | | Revise paragraph (a revised #3164)Paolo G. Giarrusso2013-11-231-3/+3
| | |_|_|_|/ | |/| | | | | | | | | | Revise text further, following suggestions in #3164 and part of the suggestions by @som-snytt. But I've kept "appear", since this paragraph documents the external behavior, not the implementation.
* | | | | | Merge pull request #3137 from xeno-by/topic/implicit-macros-invalidate-on-errorAdriaan Moors2013-11-221-0/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | correctly fails implicit search for invalid implicit macros
| * | | | | | correctly fails implicit search for invalid implicit macrosEugene Burmako2013-11-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a rare corner case when implicit search wouldn’t discard an invalid implicit macro (e.g. the one with mismatching macro impl or the one with macro impl defined in the same compilation run) during typechecking the corresponding candidate in typedImplicit1. This is now fixed.
* | | | | | | Merge pull request #3182 from soc/SI-7999Adriaan Moors2013-11-221-3/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | s.u.c.NonFatal: StackOverflowError is fatal
| * | | | | | | SI-7999 s.u.c.NonFatal: StackOverflowError is fatalSimon Ochsenreither2013-11-221-3/+1
| | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As demonstrated in https://groups.google.com/d/topic/scala-language/eC9dqTTBYHg, SOEs should be considered fatal, because all popular JVM implementations seem to run into inconsistent state (ignoring finally blocks leading to not running monitorExit, leading to locks not being unlocked, ...) if one just pushes them enough.
* | | | | | | Merge pull request #3160 from retronym/ticket/7983Adriaan Moors2013-11-221-17/+12
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Fix implicit divergence regression
| * | | | | | Account for a variation of package types in Implicit Divergence.Jason Zaugg2013-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While debugging pos/t7983.scala, I noticed that: complexity(scala.type): 1 complexity(Int): 2 The intent of the code is that top level classes should have a complexity of one. This commit restores that for cases when we see the prefix type as a ThisType, rather than a SingleType. I can't construct a test case in which this small difference is observable in the divergence checks.
| * | | | | | Code reformatting in ImplicitsJason Zaugg2013-11-191-16/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And use List#sum, rather than a fold. No functional change.
| * | | | | | SI-7983 Fix regression in implicit divergence checkingJason Zaugg2013-11-191-1/+1
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As seen in Slick. Regressed in 039b1cb1a5b8. In that commit, a call to `normalize` was replaced with `dealiasWiden` as part of a broad sweeping change. However, while the latter does less than the former with regards to eta expansion ofhigher kinded type refs (the motivation of that commit), it also does more when it comes to singleton types: they are widened to the underlying type. This was widening away `SingleType(<<package a.b>>, <<package c>>)` before the special case assiging that type component a complexity of zero could kick in. In the test case, extracted from Slick, this meant that the divergence check would consider that the second type below to outrank the first in the complexity measure, and abort the implicit search. Shape[?, ? (Coffees, Coffees), ?] Shape[DivergenceTest.this.Flat, ?, Coffees, ?] After this change, the number of packages enclosing `DivergenceTest` no longer has a bearing on the complexity score of the type. Here's how the race was run before hand: complexity(<noprefix>): 0 complexity(<root>): 1 complexity(foo.type): 2 complexity(foo.bar.type): 3 complexity(foo.bar.baz.type): 4 complexity(DivergenceTest.this.type): 5 complexity(<noprefix>): 0 complexity(<root>): 1 complexity(foo.type): 2 complexity(foo.bar.type): 3 complexity(foo.bar.baz.type): 4 complexity(DivergenceTest.this.type): 5 complexity(DivergenceTest.this.Flat): 6 complexity(<noprefix>): 0 complexity(<root>): 1 complexity(scala.type): 2 complexity(Int): 3 complexity(?): 1 complexity(DivergenceTest.this.Shape2[DivergenceTest.this.Flat,Int,?]): 16 complexity(<noprefix>): 0 complexity(<root>): 1 complexity(foo.type): 2 complexity(foo.bar.type): 3 complexity(foo.bar.baz.type): 4 complexity(DivergenceTest.this.type): 5 complexity(?): 1 complexity(<noprefix>): 0 complexity(<root>): 1 complexity(scala.type): 2 complexity(<noprefix>): 0 complexity(Coffees): 1 complexity(<noprefix>): 0 complexity(<root>): 1 complexity(scala.type): 2 complexity(Int): 3 complexity((Coffees, Int)): 7 complexity(?): 1 complexity(DivergenceTest.this.Shape2[?,(Coffees, Int),?]): 15 dominates(DivergenceTest.this.Shape2[_ <: DivergenceTest.this.Flat, Int, U2], DivergenceTest.this.Shape2[_ <: Level, (Coffees, Int), U1]): true And afterwards: complexity(DivergenceTest.this.type): 1 complexity(DivergenceTest.this.type): 1 complexity(DivergenceTest.this.Flat): 2 complexity(scala.type): 1 complexity(Int): 2 complexity(?): 1 complexity(DivergenceTest.this.Shape2[DivergenceTest.this.Flat,Int,?]): 7 complexity(DivergenceTest.this.type): 1 complexity(?): 1 complexity(scala.type): 1 complexity(<noprefix>): 0 complexity(Coffees): 1 complexity(scala.type): 1 complexity(Int): 2 complexity((Coffees, Int)): 5 complexity(?): 1 complexity(DivergenceTest.this.Shape2[?,(Coffees, Int),?]): 9 dominates(DivergenceTest.this.Shape2[_ <: DivergenceTest.this.Flat, Int, U2], DivergenceTest.this.Shape2[_ <: Level, (Coffees, Int), U1]): false Notice that even in the after shot, `scala.Int` has a complexity of 2. It should be 1; this will be fixed in a separate commit.
* | | | | | Merge pull request #3162 from retronym/ticket/7985Jason Zaugg2013-11-221-3/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7985 Allow qualified type argument in patterns
| * | | | | | SI-7985 Refactor parsing of pattern type argsJason Zaugg2013-11-191-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just parse as though it is a type, and post process to add the Bind if it turns out to be a type variable.
| * | | | | | SI-7985 Allow projection of lower-cased prefix as pattern type argJason Zaugg2013-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per the last commit, tighten up the interpretation of a lower cased identifier meaning that we're looking at a type variable.
| * | | | | | SI-7985 Allow qualified type argument in patternsJason Zaugg2013-11-191-1/+1
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were considering the lower case `s` in `case _: Array[scala.Int]` as a sign that we were dealing with a type variable pattern. Now, we only do this if a lookahead confirms the absence of a the `.`
* | | | | | Merge pull request #3154 from huitseeker/issue/SI-7221-PRJason Zaugg2013-11-221-72/+79
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7221 Rewrites pollForWork non-recursively
| * | | | | | SI-7221 rewrites pollForWork non-recursivelyFrançois Garillot2013-11-201-72/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #1001407
* | | | | | | Merge pull request #3134 from xeno-by/topic/is-term-macroJason Zaugg2013-11-221-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | more precise isMacroApplication check
| * | | | | | | more precise isMacroApplication checkEugene Burmako2013-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces the `symbol.isMacro` check with `symbol.isTermMacro`. Doesn’t make any difference to trunk but helps a lot with macro annotations.
* | | | | | | | Merge pull request #3156 from JamesIry/remove_deprecated_migration_constructorJason Zaugg2013-11-221-4/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Remove deprecated constructor from the migration annotation
| * | | | | | | | Remove deprecated constructor from the migration annotationJames Iry2013-11-181-4/+1
| | |_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The migration annotation had a deprecated 2 arg constructor that was deprecated in 2.10.0. This commit removes that constructor. Because migration is private to the scala package this change shouldn’t affect the rest of the community.
* | | | | | | | Merge pull request #3138 from densh/pr/fresh-name-extractorJason Zaugg2013-11-225-26/+43
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Refactor out fresh name prefix extraction logic
| * | | | | | | | use more specific cake dependenciesDen Shabalin2013-11-201-1/+1
| | | | | | | | |
| * | | | | | | | refactor out fresh name prefix extraction logicDen Shabalin2013-11-175-26/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. refactor out FreshNameExtractor out of Quasiquotes cake into SymbolTable (can’t put it outside due to the fact that names are path-dependent) 2. add optional parameter to the fresh name creator to cover additional qq$ prefix needed for quasiquotes 3. add unit tests
* | | | | | | | | Merge pull request #3152 from paulp/pr/deprecationsJason Zaugg2013-11-2222-654/+32
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Removing deprecated code.
| * | | | | | | | | Removing deprecated code.Paul Phillips2013-11-1822-654/+32
| | |/ / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code which has been deprecated since 2.10.0 and which allowed for straightforward removal.
* | | | | | | | | Merge pull request #3131 from densh/pr/deprecate-pair-and-tripleJason Zaugg2013-11-2220-56/+58
|\ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|_|/ |/| | | | | | | | Deprecate Pair and Triple
| * | | | | | | | deprecate Pair and TripleDen Shabalin2013-11-2020-56/+58
| |/ / / / / / /
* | | | | | | | Merge pull request #3176 from densh/pr/deprecate-responderAdriaan Moors2013-11-211-0/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | deprecate scala.Responder
| * | | | | | | | deprecate scala.ResponderDen Shabalin2013-11-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed earlier it doesn’t really belong to the scala package.
* | | | | | | | | Merge pull request #3173 from retronym/topic/classOf-type-applyGrzegorz Kossakowski2013-11-211-1/+1
|\ \ \ \ \ \ \ \ \ | |/ / / / / / / / |/| | | | | | | | Handle TypeApply(fun, ...) for symbol-less funs
| * | | | | | | | Handle TypeApply(fun, ...) for symbol-less funsJason Zaugg2013-11-211-1/+1
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Such as class literals, as one could conjure in `classOf[Int][Int]` Before, this would crash with a `NullPointerException`
* / / / / / / / SI-7280 Remove unneccesary methodLuc Bourlier2013-11-201-3/+0
|/ / / / / / /
* | | | | | | Merge pull request #3153 from misfo/patch-1v2.11.0-M7James Iry2013-11-181-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix a typo in the `scala` man page
| * | | | | | | Fix a typo in the `scala` man pageTrent Ogren2013-11-181-1/+1
| | | | | | | |
* | | | | | | | Merge pull request #3140 from skyluc/issue/completion-import-object-7280Jason Zaugg2013-11-185-35/+100
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7280 Scope completion not returning members provided by imports
| * | | | | | | | SI-7280 Scope completion not returning members provided by importsLuc Bourlier2013-11-151-24/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updates localeContext() to return the best context possible when there are none directly associated with the given position. It happens when an expression cannot be successfully typed, as no precise ContextTree covers the expression location, or if the position is not inside any expression. Adds corresponding tests