summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2276 from scalamacros/topic/macro-traceJames Iry2013-03-201-1/+1
|\ | | | | an amazing discovery made by Iulian
| * an amazing discovery made by IulianEugene Burmako2013-03-181-1/+1
| | | | | | | | | | Traces were stalling macro expansions by evaluating messages even when -Ymacro-debug-* flags were disabled.
* | Merge pull request #2283 from scalamacros/topic/silence-the-logJames Iry2013-03-201-1/+1
|\ \ | | | | | | fixes the craziness in JavaUniverse.log
| * | fixes the craziness in JavaUniverse.logEugene Burmako2013-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | This long-standing, but trivial to fix nuisance in the implementation of runtime reflection actively avoided being fixed in both 2.10.0 and 2.10.1. It's finally the time to put it to a rest.
* | | Merge pull request #2261 from soc/SI-7258James Iry2013-03-202-3/+3
|\ \ \ | | | | | | | | SI-7258 Don't assume order of reflection values in t6223
| * | | SI-7258 Don't assume order of reflection values in t6223Simon Ochsenreither2013-03-152-3/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | test/files/run/t6223's check file expects a specific ordering of the reflected values. The ordering is not guaranteed by the runtime/reflection API and can change. Therefore, sort the values before comparing them.
* | | Merge pull request #2269 from retronym/ticket/7259James Iry2013-03-207-1/+33
|\ \ \ | |_|/ |/| | SI-7259 Fix detection of Java defined Selects
| * | SI-7259 Fix detection of Java defined SelectsJason Zaugg2013-03-167-1/+33
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for SI-3120, 3ff7743, introduced a fallback within `typedSelect` that accounted for the ambiguity of a Java selection syntax. Does `A.B` refer to a member of the type `A` or of the companion object `A`? (The companion object here is a fiction used by scalac to group the static members of a Java class.) The fallback in `typedSelect` was predicated on `context.owner.enclosingTopLevelClass.isJavaDefined`. However, this was incorrectly including Select-s in top-level annotations in Scala files, which are owned by the enclosing package class, which is considered to be Java defined. This led to nonsensical error messages ("type scala not found.") Instead, this commit checks the compilation unit of the context, which is more direct and correct. (As I learned recently, `currentUnit.isJavaDefined` would *not* be correct, as a lazy type might complete a Java signature while compiling some other compilation unit!) A bonus post factum test case is included for SI-3120.
* | Merge pull request #2271 from retronym/topic/mima-refactorAdriaan Moors2013-03-181-91/+44
|\ \ | | | | | | Reduce duplication and increase verbosity in MiMa execution.
| * | Reduce duplication and increase verbosity in MiMa execution.Jason Zaugg2013-03-161-91/+44
| |/ | | | | | | | | This helps to see whether we've broken forward or backward binary compatibility.
* | Merge pull request #2255 from retronym/ticket/7249Adriaan Moors2013-03-173-1/+13
|\ \ | | | | | | SI-7249 Reign in overzealous Function0 optimization.
| * | SI-7249 Reign in overzealous Function0 optimization.Jason Zaugg2013-03-133-1/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | The fix for SI-1247 went too far, and could result in premature evaluation of the expression that yields the Function0. This commit checks that said expression is safe to inline. If not, a wrapper `() => ....` is still required. The optimization is still enabled in sitations like the original test case, run/t1247.scala.
* | Merge pull request #2253 from retronym/ticket/7239Adriaan Moors2013-03-174-4/+52
|\ \ | | | | | | SI-6921 SI-7239 Tread lightly during exploratory typing
| * | SI-6921 SI-7239 Tread lightly during exploratory typingJason Zaugg2013-03-134-4/+52
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deciding whether an Assign is a named argument or and assignment expression, or when looking at arguments that the current selection is applied to in order to evaluate candidate implicit views, we risk polluting the tree by setting error types. This happens even if we are in 'silent' mode; that mode does silence the error report, but not the side effect on the tree. This commit adds strategic `duplicate` calls to address the problem symptomatically. Duplicating trees and retyping in general reach into the domain of bugs umbrella-ed under SI-5464, but in these places we should be safe because the tree is in the argument position, not somewhere where, for example, a case class-es synthetic companion object might be twice entered into the same scope. Longer term, we'd like to make type checking side effect free, so we wouldn't need to play whack-a-mole like this. That idea is tracked under SI-7176.
* | Merge pull request #2247 from retronym/ticket/7232-2Adriaan Moors2013-03-1717-2/+96
|\ \ | |/ |/| SI-7232 Fix Java import vs defn. binding precendence
| * SI-7232 Fix Java import vs defn. binding precendenceJason Zaugg2013-03-1317-2/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java Spec: > A single-type-import declaration d in a compilation unit c > of package p that imports a type named n shadows, throughout > c, the declarations of: > - any top level type named n declared in another compilation > unit of p > - any type named n imported by a type-import-on-demand > declaration in c > - any type named n imported by a static-import-on-demand > declaration in c Scala Spec: > Bindings of different kinds have a precedence defined on them: > 1. Definitions and declarations that are local, inherited, or made > available by a package clause in the same compilation unit where > the definition occurs have highest precedence. > 2. Explicit imports have next highest precedence.
* | Merge pull request #2234 from scalamacros/ticket/7240Paul Phillips2013-03-125-2/+53
|\ \ | | | | | | SI-7240 fixes language feature lookup
| * | SI-7240 fixes language feature lookupEugene Burmako2013-03-125-2/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As I discovered today, Definitions.getMember have a fallback clause, which accounts for the phases which have inner classes flattened. This fallback uses nme.flattenedName to compute a flattened name, but unfortunately nme.flattenedName produces a TermName, not a TypeName, which means that the fallback will commence search in a wrong namespace with predictable results. The commit also changes another usage of nme.flattenedName in a type name context. That one was correctly converting a TermName result to TypeName, so this is not a bugfix, but just a refactoring for the sake of being consistent.
* | | Merge pull request #2230 from retronym/ticket/7233Paul Phillips2013-03-124-1/+24
|\ \ \ | | | | | | | | SI-7233 Account for aliased imports in EtaExpansion / Erasure
| * | | SI-7233 Account for aliased imports in ErasureJason Zaugg2013-03-102-1/+9
| | | | | | | | | | | | | | | | When we discard the fiction of `scala.Any`.
| * | | SI-7233 Account for aliased imports in eta expansion.Jason Zaugg2013-03-102-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Buggy: treeCopy.Select(sel, sel.qual, sel.name) setSymbol null Select(sel, sel.qual, sel.name) Okay: treeCopy.Select(sel, sel.qual, sel.name) Select(sel, sel.qual, sel.symbol.name) // but doesn't copyAttrs! It is an easy mistake to make, I've found one more occurance: def foo(a: Any) = { import a.{toString => toS}; toS } error: uncaught exception during compilation: scala.reflect.internal.FatalError scala.reflect.internal.FatalError: class Object does not have a member toS at scala.reflect.internal.Definitions$DefinitionsClass.scala$reflect$internal$Definitions$DefinitionsClass$$fatalMissingSymbol(Definitions.scala:1028) A followup commit will address that problem.
* | | | Merge pull request #2222 from scalamacros/ticket/6725Paul Phillips2013-03-125-1/+23
|\ \ \ \ | | | | | | | | | | SI-6725 `f` interpolator now supports %n tokens
| * | | | SI-6725 `f` interpolator now supports %n tokensEugene Burmako2013-03-095-1/+23
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the `f` interpolator supports format specifiers which specify conversions for formatted arguments. However Java formatting is not limited to argument-related conversions as explained in: http://docs.oracle.com/javase/6/docs/api/java/util/Formatter.html#detail. Conversions which don't correspond to any arguments are `%` (used to emit verbatim `'%'` characters) and `n` (used to emit platform-specific line separators). Of those only the former is supported, and this patch fixes the oversight.
* | | | Merge pull request #2227 from mergeconflict/2.10.x-SI-7132Paul Phillips2013-03-123-15/+22
|\ \ \ \ | | | | | | | | | | SI-7132 - don't discard Unit type in interpreter
| * | | | SI-7132 - don't discard Unit type in interpreterDan Rosen2013-03-093-15/+22
| | | | |
* | | | | Merge pull request #2224 from retronym/ticket/7238Adriaan Moors2013-03-113-3/+16
|\ \ \ \ \ | | | | | | | | | | | | SI-7328 Bail out of names/defaults when args are error typed
| * | | | | SI-7328 Bail out of names/defaults if args are error typedJason Zaugg2013-03-093-3/+16
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | To avoid a crasher later on with a null type inside a sequence argument.
* | | | | Merge pull request #2225 from retronym/ticket/7234Adriaan Moors2013-03-113-7/+45
|\ \ \ \ \ | | | | | | | | | | | | SI-7234 Make named args play nice with dep. method types
| * | | | | SI-7234 Make named args play nice with dep. method typesJason Zaugg2013-03-093-7/+45
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | Some care is needed to avoid interaction with constant types (e.g pos/z1730.scala) and with existentials (e.g. t3507-old.scala).
* | | | | Merge pull request #2221 from scalamacros/ticket/5710Adriaan Moors2013-03-114-0/+32
|\ \ \ \ \ | | | | | | | | | | | | SI-5710 has fixed itself
| * | | | | SI-5710 has fixed itselfEugene Burmako2013-03-094-0/+32
| | |_|_|/ | |/| | | | | | | | | | | | | My job here is only to submit tests.
* | | | | Merge pull request #2223 from scalamacros/ticket/7235Adriaan Moors2013-03-116-0/+42
|\ \ \ \ \ | | | | | | | | | | | | reifier is now aware of SI-7235
| * | | | | reifier is now aware of SI-7235Eugene Burmako2013-03-096-0/+42
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-7235 is caused by a long-standing todo in typedRefinement, which leads to originals of compound type trees swallowing their stats. I'm not sure how exactly to fix SI-7235, but what I am sure about is that we shouldn't silently discard stats during reification. This patch introduces a new implementation restrictions, which now reports that reify of compound type trees with non-empty stats isn't going to work.
* | | | | Merge pull request #2228 from retronym/ticket/7226Adriaan Moors2013-03-112-0/+32
|\ \ \ \ \ | |_|_|/ / |/| | | | SI-7226 Fix inference regression caused by TypeVar equality
| * | | | SI-7226 Fix inference regression caused by TypeVar equality.Jason Zaugg2013-03-092-0/+32
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TypeVars, being mutable creatures, mustn't have structural equality/hashing, otherwise TypeRefs that differ only by having distinct TypeVars as components get wrongly uniqued together. The reported bug showed the disaterous consequences: constraints from the `C?[Int]` in the return type applied to the `?C[?A]` in the parameter list. This commit overrides `equals` and `hashCode` in `TypeVar` to use reference equality. An alternative fix would be to drop the `case`-ness of the class, as was the case before 0cde930b when this regressed.
* | | | Merge pull request #2212 from dragos/fix/SI-7224James Iry2013-03-083-2/+169
|\ \ \ \ | |_|/ / |/| | | Fix SI-7224.
| * | | Fix SI-7224.Iulian Dragos2013-03-073-2/+169
|/ / / | | | | | | | | | | | | | | | | | | Don't focus positions assigned to the TypeTree of a parent of a Template when the parent exists in the source. A focused position (instance of `OffsetPosition`) makes it invisible to the presentation compiler when it looks for the innermost enclosing tree of a given position (breaking hyperlinking, for example).
* | | Merge pull request #2199 from retronym/ticket/7214Adriaan Moors2013-03-052-1/+60
|\ \ \ | | | | | | | | SI-7214 outer check based on dealiased pattern type.
| * | | SI-7214 outer check based on dealiased pattern type.Jason Zaugg2013-03-052-1/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Typed Pattern (_: T) is more than `.isInstanceOf`: if `T` is a path dependent type, the scrutinee's $outer reference is also compared against the prefix of `T`. The code that synthesises this is split into two places. `needsOuterCheck` determines whether to add this check, based on the type `T`, and the type of the scrutinee. If it gives the go-ahead, `treeCondStrategy.outerCheck` synthesizes the check. The new test case demonstrates the problems caused by the failure to dealias in `needsOuterCheck`: it could either wrongly lead to synthesis of an outer test (which would crash), or wrongly omit the outer test (meaning overly liberal matching.) A simple `dealias` remedies this. `dealiasWiden` is *not* appropriate here; we need to keep hold of singleton types. I'll also note that there is already a little slack between these methods, as commented: > ExplicitOuter replaces `Select(q, outerSym) OBJ_EQ expectedPrefix` > by `Select(q, > outerAccessor(outerSym.owner)) OBJ_EQ expectedPrefix` > if there's an outer accessor, otherwise the condition becomes `true` > TODO: can we improve needsOuterTest so there's always an outerAccessor? So this is probably a fragile area that warrants a careful review with a view to design improvements.
* | | | Merge pull request #2156 from vigdorchik/hierarchyAdriaan Moors2013-03-0511-145/+171
|\ \ \ \ | | | | | | | | | | SI-7109 SI-7153 Generalize the API to get docComments: allow to force do...
| * | | | SI-7109 SI-7153 Generalize the API to get docComments: allow to force docTreesEugene Vigdorchik2013-02-2411-145/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for given fragments. Don't type-check when forcing doc comments, but rather do it directly. Test the new functionality as well as better tests for the old one.
* | | | | Merge pull request #2193 from adriaanm/patmat-refactorAdriaan Moors2013-03-0518-374/+386
|\ \ \ \ \ | | | | | | | | | | | | merge 2.10.1 into 2.10.x
| * \ \ \ \ Merge 2.10.1 into 2.10.xAdriaan Moors2013-03-038-74/+40
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for SI-7183 in 440bf0a8c2 was forward ported in f73d50f46c. Conflicts: src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
| | * \ \ \ \ Merge pull request #2190 from adriaanm/test-runs-mima-2.10.1v2.10.1-RC3v2.10.1James Iry2013-03-022-4/+8
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | test.done again checks bin compat (using mima 0.1.5)
| | | * | | | | test.done again checks bin compat (using mima 0.1.5)Adriaan Moors2013-03-012-4/+8
| | | | | | | |
| | * | | | | | Merge pull request #2189 from adriaanm/ticket-7195James Iry2013-03-024-64/+3
| | |\ \ \ \ \ \ | | | |/ / / / / | | |/| | | | | [nomaster] SI-7195 minor version mustn't introduce warnings
| | | * | | | | [nomaster] SI-7195 minor version mustn't introduce warningsAdriaan Moors2013-03-014-64/+3
| | |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want 2.10.1 to be a drop-in replacement for 2.10.0, so we can't start warning where we weren't warning in 2.10.0. See SI-5954 (#1882, #2079) for when it was an implementation restriction, which was then weakened to a warning. It's now hidden behind -Ydebug.
| | * | | | | Merge pull request #2168 from retronym/ticket/7183Adriaan Moors2013-03-013-14/+42
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | SI-7183 Disable unreachability for withFilter matches.
| | | * | | | | SI-7183 Disable unreachability for withFilter matches.Jason Zaugg2013-02-253-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids spurious unreachable warnings on code that the user didn't write. The parser desugars for-comprehensions such as: for (A(a) <- List(new A)) yield a To: List(new A()).withFilter(((check$ifrefutable$2) => check$ifrefutable$2: @scala.unhecked match { case A((a @ _)) => true case _ => false }) ) But, if `A.unapply` returns `Some[_]`, the last case is dead code. (Matching against a regular case class *would* fall through in the caes of a null scrutinee.) In SI-6902, we enabled unreachability warnings, even if the scrutinee was annotated as @unchecked. That was consistent with the 2.9.2 behaviour, it was only disabled temporarily (actually, accidentally) in 2.10.0. But, the old pattern matcher didn't warn about this code. This commit makes the pattern matcher recognise the special scrutinee based on its name and disables both exhaustivity *and* unreachability analysis. To do so, the we generalize the boolean flag `unchecked` to the class `Suppression`.
| | * | | | | | Merge pull request #2167 from retronym/ticket/7126Adriaan Moors2013-03-013-6/+29
| | |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7126 Account for the alias types that don't dealias.