summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
Commit message (Collapse)AuthorAgeFilesLines
...
| * SI-8965 Account for corner case in "unrelated types" warningJason Zaugg2014-11-071-1/+1
| | | | | | | | | | It's okay for the two types to LUB to something above `Object` if they both individially were its supertype.
* | SI-8954 Make @deprecated{Overriding,Inheritance} aware of @deprecated.Antoine Gourlay2014-11-061-2/+2
|/ | | | | | | | | | | | | | | This makes sure that: - there is no warning for a @deprecated class inheriting a @deprecatedInheritance class - there is no warning for a @deprecated method overriding a @deprecatedOverriding method - there is no "deprecation won't work" warning when overriding a member of a @deprecatedInheritance class with a @deprecated member - the above works even if the classes/methods are indirectly deprecated (i.e. enclosed in something @deprecated) This should remove quite a few useless deprecation warnings from the library.
* Merge pull request #3932 from gourlaysama/wip/t8498Jason Zaugg2014-09-041-1/+2
|\ | | | | SI-8498 @compileTimeOnly should be aware of bridge methods.
| * SI-8498 @compileTimeOnly should be aware of bridge methods.Antoine Gourlay2014-08-211-1/+2
| | | | | | | | | | | | Calling a @compileTimeOnly method from another @compileTimeOnly method happens when the former gets a bridge method. It should not throw an error. Calling the bridge or the method will anyway.
* | SI-8828 fix regression in Xlint visibility warning for sealed classesAntoine Gourlay2014-08-281-1/+1
|/ | | | | | | | | | | | 5dfcf5e reverted a change to `Symbol#isEffectivelyFinal` (made in adeffda) that broke overriding checks, and moved the new enhanced version to a new method. However, the test for inaccessible type access still uses the old one, so it lost the ability to see that the owner of some method is either final or sealed and not overridden. This just makes it use the new `isEffectivelyFinalOrNotOverriden`.
* SI-8525 No anonymous lintSom Snytt2014-07-101-4/+4
| | | | | | | | | Turn anonymous references to `settings.lint` into named settings. After that, trust to Adriaan to make them filterable. There are a few remaining top-level -Y lint warnings that are deprecated.
* Encapsulate deprecation warning message synthesis.Adriaan Moors2014-07-041-1/+1
| | | | | | | Both refchecks and typer constructed the same message. But different. Now with more DRYness. Note that no check files had to be updated (disconcerting)...
* Rip out reporting indirection from CompilationUnitAdriaan Moors2014-07-041-37/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inline the forwarders from CompilationUnit, which should not affect behavior. Since all forwarders lead to global.reporter, don't first navigate to a compilation unit, only to then forward back to global.reporter. The cleanup in the previous commits revealed a ton of confusion regarding how to report an error. This was a mechanical search/replace, which has low potential for messing things up, since the list of available methods are disjoint between `reporter` and `currentRun.reporting`. The changes involving `typer.context` were done previously. Essentially, there are three ways to report: - via typer.context, so that reporting can be silenced (buffered) - via global.currentRun.reporting, which summarizes (e.g., deprecation) - via global.reporter, which is (mostly) stateless and straightforward. Ideally, these should all just go through `global.currentRun.reporting`, with the typing context changing that reporter to buffer where necessary. After the refactor, these are the ways in which we report (outside of typer): - reporter.comment - reporter.echo - reporter.error - reporter.warning - currentRun.reporting.deprecationWarning - currentRun.reporting.incompleteHandled - currentRun.reporting.incompleteInputError - currentRun.reporting.inlinerWarning - currentRun.reporting.uncheckedWarning Before: - c.cunit.error - c.enclosingUnit.deprecationWarning - context.unit.error - context.unit.warning - csymCompUnit.warning - cunit.error - cunit.warning - currentClass.cunit.warning - currentIClazz.cunit.inlinerWarning - currentRun.currentUnit.error - currentRun.reporting - currentUnit.deprecationWarning - currentUnit.error - currentUnit.warning - getContext.unit.warning - getCurrentCUnit.error - global.currentUnit.uncheckedWarning - global.currentUnit.warning - global.reporter - icls.cunit.warning - item.cunit.warning - reporter.comment - reporter.echo - reporter.error - reporter.warning - reporting.deprecationWarning - reporting.incompleteHandled - reporting.incompleteInputError - reporting.inlinerWarning - reporting.uncheckedWarning - typer.context.unit.warning - unit.deprecationWarning - unit.echo - unit.error - unit.incompleteHandled - unit.incompleteInputError - unit.uncheckedWarning - unit.warning - v1.cunit.warning All these methods ended up calling a method on `global.reporter` or on `global.currentRun.reporting` (their interfaces are disjoint). Also clean up `TypeDiagnostics`: inline nearly-single-use private methods.
* Track symbol that caused a deprecation warning.Adriaan Moors2014-07-041-8/+6
| | | | | | | | | | | | So that we can filter deprecations based on defining package. Configurable error reporting will support a rule like: "In compilation unit X, escalate deprecation warnings that result from accessing members in package P that have been deprecated since version V. Report an error instead of a warning for those." TODO: remove deprecationWarning overload that doesn't take a `Symbol`? (Replace by a default value of `NoSymbol` for the deprecated symbol arg?)
* SI-8537 Puts SI-8157 fix under XsourceFrançois Garillot2014-04-251-1/+10
|
* Merge remote-tracking branch 'origin/master' into topic/palladium0Eugene Burmako2014-02-141-1/+6
|\
| * Merge pull request #3389 from retronym/ticket/8134-2Jason Zaugg2014-02-131-1/+1
| |\ | | | | | | SI-8134 SI-5954 Fix companions in package object under separate comp.
| | * SI-5954 Invalidate TypeRef cache when opening package objectJason Zaugg2014-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed that the pos/5954d was tripping a println "assertion". This stemmed from an inconsistency between `TypeRef#{parents, baseTypeSeq}` for a package objects compiled from source that also has a class file from a previous compilation run. I've elevated the println to a devWarning, and changed `updatePosFlags`, the home of this evil symbol overwriting, to invalidate the caches in the symbols info. Yuck. I believe that this symptom is peculiar to package objects because of the way that the completer for packages calls `parents` during the Namer phase for package objects, before we switch the symbol to represent the package-object-from-source. But it seems prudent to defensively invalidate the caches for any symbol that finds its way into `updatePosFlags`.
| * | SI-8177 refine embeddedSymbolsAdriaan Moors2014-02-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We look for any prefix that has a refinement class for a type symbol. This includes ThisTypes, which were not considered before. pos/t8177g.scala, neg/t0764*scala now compile, as they should Additional test cases contributed by Jason & Paul.
| * | SI-8177 co-evolve more than just RefinedTypesAdriaan Moors2014-02-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `asSeenFrom` produced a typeref of the shape `T'#A` where `A` referred to a symbol defined in a `T` of times past. More precisely, the `TypeRef` case of `TypeMap`'s `mapOver` correctly modified a prefix from having an underlying type of `{ type A = AIn }` to `{ type A = Int }`, with a new symbol for `A` (now with info `Int`), but the symbol in the outer `TypeRef` wasn't co-evolved (so it still referred to the `A` in `{ type A = AIn }` underlying the old prefix). `coEvolveSym` used to only look at prefixes that were directly `RefinedType`s, but this bug shows they could also be `SingleType`s with an underlying `RefinedType`.
* | | disambiguates uses of “local” in internal symbol APIEugene Burmako2014-02-121-5/+5
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There’s been a conflation of two distinct meanings of the word “local” in the internal symbol API: the first meaning being “local to this” (as in has the LOCAL flag set), the second meaning being “local to block” (as in declared in a block, i.e. having owner being a term symbol). Especially confusing is the fact that sym.isLocal isn’t the same as sym.hasFlag(LOCAL), which has led to now fixed SI-6733. This commit fixes the semantic mess by deprecating both Symbol.isLocal and Symbol.hasLocalFlag (that we were forced to use, because Symbol.isLocal had already been taken), and replacing them with Symbol.isLocalToThis and Symbol.isLocalToBlock. Unfortunately, we can’t remove the deprecated methods right away, because they are used in SBT, so I had to take small steps.
* | further limits discoverability of resetAttrsEugene Burmako2014-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit removes resetAllAttrs from the public reflection API. This method was previously deprecated, but on a second thought that doesn't do it justice. People should be aware that resetAllAttrs is just wrong, and if they have code that uses it, this code should be rewritten immediately without beating around the bush with deprecations. There's a source-compatible way of achieving that (resetLocalAttrs), so that shouldn't bring much trouble. Secondly, resetAllAttrs in compiler internals becomes deprecated. In subsequent commits I'm going to rewrite the only two locations in the compiler that uses it, and then I think we can remove it from the compiler as well.
* | Optimize the pickler phaseJason Zaugg2014-01-311-0/+7
| | | | | | | | | | | | | | | | - move "erroneous type" diagnostic into a crash recovery handler, rather than running it proactively - move the "unexpanded macros" check into refchecks. Cuts this phase in half, from about 1% of compile time to 0.5%.
* | Merge pull request #3368 from retronym/ticket/8151Grzegorz Kossakowski2014-01-211-2/+2
|\ \ | | | | | | SI-8151 Remove -Yself-in-annots and associated implementation
| * | SI-8151 Remove -Yself-in-annots and associated implementationJason Zaugg2014-01-151-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This experimental option typechecked arguments of annotations with an injected value in scope named `self`: @Foo(self.foo < 1) This has been slated for removal [1] for some time. This commit removes it in one fell swoop, without any attempt at source compatibility with code that constructs or pattern matches on AnnotatedType. [1] https://groups.google.com/d/msg/scala-internals/VdZ5UJwQFGI/C6tZ493Yxx4J
* / SI-8157 Make overloading, defaults restriction PolyType awareJason Zaugg2014-01-171-5/+1
|/ | | | | | | | | | Named/Default args levies an implementation restriction that only one overloaded alternative may declare defaults. But, this restriction failed to consider polymorphic methods. Rather than matching on MethodType, this commit uses `Type#paramms`, which handles PolyTypes and curried MethodTypes in one fell swoop.
* SI-6120 Suppress extra warningsSom Snytt2013-12-161-147/+152
| | | | | | | | | | | | | | | | 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.
* streamlines refchecking undesired symbol propertiesEugene Burmako2013-12-091-28/+16
| | | | | | Unifies `checkDeprecated`, `checkMigration` and `checkCompileTimeOnly` into a single centralized point of reference that is now consistently called from `checkTypeRef`, `transformIdent` and `transformSelect`.
* SI-7872 Plug a variance exploit in refinement typesJason Zaugg2013-11-231-0/+2
| | | | | | | | | | | | | | | | 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.
* SI-7678 Don't cache member symbols of TypeTags in Definitions.Jason Zaugg2013-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | It we can only safely use vals in Definitions for top-level symbols. Otherwise, when the IDE switches to loading the symbol from source, we can hold on to a stale symbol, which in turn impedes implicit materialization of TypeTags. This commit moves (most) of the accessors for member symbols into RunDefinitions, and changes calling code accordingly. This is a win for presentation compiler correctness, and might even shave of a few cycles. In a few cases, I have had to leave a `def` to a member symbol in Definitions so we can get to it from the SymbolTable cake, which doesn't see RunDefinitions. The macro FastTrack facility now correctly recreates the mapping from Symbol to macro implementation each run, using a new facility in perRunCaches to create a run-indexed cache. The enclosed test recreates the situation reported in the ticket, in which TypeTags.scala is loaded from source.
* Merge remote-tracking branch 'scala/2.10.x' into merge-2.10.xGrzegorz Kossakowski2013-10-161-1/+5
|\ | | | | | | | | | | Conflicts: build.number test/files/neg/classmanifests_new_deprecations.check
| * SI-7783 Don't issue deprecation warnings for inferred TypeTreesJason Zaugg2013-09-271-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Deprecation checks in RefChecks were looking into all TypeTrees to find references to deprecated type aliases. However, when the compiler infers a type argument or type of a member it creates a TypeTree (with a null original) that was also leading to warnings. I ran into this problem often when upgrading a build from SBT 0.12 to 0.13: a plugin I was using used the deprecated type alias, and I suffered transitively when I used methods from its API. This commit disables the checks for inferred TypeTree-s.
* | Generalize OverridingPairs to SymbolPairs.Paul Phillips2013-10-051-73/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Increases your chance of knowing what is going on in OverridingPairs. Introduces some new abstractions which I hope for your own sakes you will put to use in some way: RelativeTo: operations relative to a prefix SymbolPair: two symbols being compared for something, and the enclosing class where the comparison is being performed Fixed a minor bug with access by accident by way of more principled pair analysis. See run/private-override.scala. Upgraded the error message issued on certain conflicts to give the line numbers of both conflicting methods, as opposed to just one and you go hunting.
* | Merge pull request #2978 from som-snytt/issue/7848-forgotten-interp-msg-lgtmPaul Phillips2013-09-271-1/+1
|\ \ | | | | | | SI-7848 Xlint no warn on $sym with params
| * | SI-7848 Xlint no warn on $sym with paramsSom Snytt2013-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This idea brought to you by retronym. Also improve implicitNotFound detection at typer; and avoid checking the standard interpolation expression for cases like s"some $$x". Some minor refactorings of implicitNotFound strings. The intersobralator allows extra spaces, i.e., trims.
* | | Merge pull request #2995 from paulp/pr/defaultparamJason Zaugg2013-09-271-3/+3
|\ \ \ | | | | | | | | Fix up DEFAULTPARAM semantics.
| * | | Fix up DEFAULTPARAM semantics.Paul Phillips2013-09-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I foolishly believed the deprecation message on "hasDefaultFlag" which suggested I use "hasDefault" instead. After lots of head scratching, I hardened the semantics so it's like this: - A method parameter with a default value is PARAM | DEFAULTPARAM - A default getter for such a parameter is METHOD | DEFAULTPARAM - And "hasDefault" is has(DEFAULTPARAM) && has(PARAM | METHOD) Why all the bonus logic, why not just hasFlag(DEFAULTPARAM)? For some reason we have a handful of overloaded flags spanning uses which someone apparently thinks can never intersect but I have not been so lucky overall. So since DEFAULTPARAM is overloaded with TRAIT, unless we think it's fine that default getters and method parameters with defaults will pose as traits all the time, there has to be an anchor bit alongside it.
* | | | Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.x-to-master-2Jason Zaugg2013-09-271-2/+2
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf build.xml src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/library/scala/concurrent/Future.scala src/reflect/scala/reflect/internal/Types.scala
| * | SI-7825 Consider DEFAULTMETHOD when refchecking concretenessJason Zaugg2013-09-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | SI-7870 Detect default getter clashes in constructorsJason Zaugg2013-09-231-3/+5
| |/ |/| | | | | | | | | | | | | | | | | Default getters for constructors live in the companion module. These eluded the check for clashes in default getter names due to overloading, which aims to give a more user friendly error than "double definition: meth$default$1". This commit checks for default getters in the companion module, in addition to those in the template itself.
* | Merge remote-tracking branch 'scala/2.10.x'Grzegorz Kossakowski2013-08-291-9/+44
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the merge, the test/run/t7733 started to fail on Jenkins. I tried to reproduce it locally but I couldn't so I think it's system dependent failure. Per @retronym's suggestion I moved it to pending to not block the whole merge. Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala src/compiler/scala/tools/nsc/typechecker/Macros.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/util/MsilClassPath.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/internal/ClassfileConstants.scala src/reflect/scala/reflect/internal/Importers.scala src/reflect/scala/reflect/internal/Trees.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala test/files/run/macro-duplicate/Impls_Macros_1.scala test/files/run/t6392b.check test/files/run/t7331c.check
| * SI-7716 Exclude patmat synthetics from bounds checkingJason Zaugg2013-08-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider this pattern match translation, that occurs *before* refchecks: scala> val e: java.lang.Enum[_] = java.util.concurrent.TimeUnit.SECONDS scala> e match { case x => x } <console>:9: error: type arguments [_$1] do not conform to class Enum's type parameter bounds [E <: Enum[E]] e match { case x => x } ^ [[syntax trees at end of refchecks]] // <console> package $line5 { case <synthetic> val x1: Enum[_$1] = $line3.$read.$iw.$iw.e; case4(){ matchEnd3(x1) }; matchEnd3(x: Enum[_$1]){ x } RefChecks turns a blind eye to the non-conformant type `Enum[_$1]` in the label defs because of `65340ed4ad2e`. (Incidentally, that is far too broad, as I've noted in SI-7756.) This commit extends this exception to cover the synthetic ValDef `x1`. Commit log watchers might notice the similarities to SI-7694.
| * SI-7694 @uncheckedBounds, an opt-out from type bounds checkingJason Zaugg2013-08-131-9/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synthetic defs introduced by transforms like named/default arguments, ANF (in scala-async) often introduce a type tree (the tpt of the temporary) that are based on the types of expressions. These types are scrutinized in RefChecks to check that type parameter bounds are satisfied. However, the type of the expression might be based on slack a LUB that fails to capture constraints between type parameters. This slackness is noted in `mergePrefixAndArgs`: // Martin: I removed this, because incomplete. Not sure there is a // good way to fix it. For the moment we just err on the conservative // side, i.e. with a bound that is too high. The synthesizer can now opt out of bounds by annotating the type as follows: val temp: (<expr.tpe> @uncheckedBounds) = expr This facility is now used in named/default arguments for the temporaries used for the reciever and arguments. The annotation is hidden under scala.reflect.internal, rather than in the more prominent scala.annotation.unchecked, to reflect the intention that it should only be used in tree transformers. The library component of this change and test case will be included in the next commit. Why split like this? It shows that the 2.10.3 compiler will work with 2.10.2 scala-reflect.jar.
* | Merge pull request #2852 from retronym/ticket/1980-warningAdriaan Moors2013-08-211-0/+14
|\ \ | | | | | | SI-1980 A lint warning for by-name parameters in right assoc methods
| * | SI-1980 A lint warning for by-name parameters in right assoc methodsJason Zaugg2013-08-191-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The desugaring of right associative calls happens in the parser. This eagerly evaluates the arguments (to preserve left-to-right evaluation order the arguments are evaluated before the qualifier). This is pretty surprising if the method being called has a by-name parameter in the first parameter section. This commit adds a warning under -Xlint when defining such a method. The relevent spec snippets: > SLS 4.6.1 says that call-by-name argument "is not evaluated at the point of function application, but instead is evaluated at each use within the function". > > But 6.12.3 offers: > "If op is right- associative, the same operation is interpreted as { val x=e1; e2.op(x ) }, where x is a fresh name."
* | | Merge pull request #2810 from xeno-by/topic/compile-time-onlyAdriaan Moors2013-08-211-0/+2
|\ \ \ | | | | | | | | @compileTimeOnly: moved to scala-library.jar, got some fixes
| * | | @compileTimeOnly now works for symbols from the empty packageEugene Burmako2013-08-151-0/+1
| | | | | | | | | | | | | | | | Looks like we've got the entire language covered now.
| * | | @compileTimeOnly now works for annotationsEugene Burmako2013-08-151-0/+1
| |/ / | | | | | | | | | | | | http://docs.scala-lang.org/overviews/macros/annotations.html say sincere "thank you!".
* | | No longer crash on NoSymbol.owner.Paul Phillips2013-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically calling NoSymbol.owner has crashed the compiler. With this commit, NoSymbol owns itself. This is consistent with the way ownership chains are handled elsewhere in the compiler (e.g. NoContext.owner is NoContext, NoSymbol.enclClass is NoSymbol, and so on) and frees every call site which handles symbols from having to perform precondition tests against NoSymbol. Since calling NoSymbol.owner sometimes (not always) indicates a bug which we'd like to catch sooner than later, I have introduced a couple more methods for selected call sites. def owner: Symbol // NoSymbol.owner is self, log if -Xdev def safeOwner: Symbol // NoSymbol.owner is self, ignore def assertOwner: Symbol // NoSymbol.owner is fatal The idea is that everyone can call sym.owner without undue anxiety or paranoid null-like tests. When compiling under -Xdev calls to `owner` are logged with a stack trace, so any call sites for which that is an expected occurrence should call safeOwner instead to communicate the intention and stay out of the log. Conversely, any call site where crashing on the owner call was a desirable behavior can opt into calling assertOwner. This commit also includes all the safeOwner calls necessary to give us a silent log when compiling scala.
* | | SI-7756 Uncripple refchecks in case bodiesJason Zaugg2013-08-161-8/+27
|/ / | | | | | | | | | | | | | | | | | | | | | | | | In 65340ed4ad2e, parts of RefChecks were disabled when we traversed into the results of the new pattern matcher. Similar logic existed for the old pattern matcher, but in that case the Match / CaseDef nodes still existed in the tree. The new approach was too broad: important checks no longer scrutinized the body of cases. This commit turns the checks back on when it finds the remnants of a case body, which appears as an application to a label def.
* | Merge remote-tracking branch 'scala/2.10.x' into merge-2.10.xGrzegorz Kossakowski2013-07-291-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/reflect/reify/phases/Reshape.scala src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/transform/Mixin.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/library/scala/concurrent/impl/Promise.scala src/reflect/scala/reflect/internal/StdAttachments.scala test/files/neg/macro-override-macro-overrides-abstract-method-b.check test/files/run/t7569.check
| * SI-7657 clarifies the "macro overrides method" ruleEugene Burmako2013-07-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | macro engine refactoringEugene Burmako2013-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Macro impl bindings now store more information in signatures. Previously it was a flattened List[Int] corresponding to flattened paramss, now it's List[List[Int]] to preserve the lengths of parameter lists. Also now we distinguish between c.Expr parameters and others. Previously actual and reference macro signatures were represented as tuples of vparamss, rets, and sometimes tparams. Now they are all abstracted behind MacroImplSig. Finally this patch provides better error messages in cases of argsc <-> paramsc and argc <-> paramc mismatches.
* | Print raw types correctly.Paul Phillips2013-05-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The "For convenience, these are usable as stub implementations" bit has generated surprisingly few angry letters, but I noticed today it blows it on raw types. Or, used to blow it. /** As seen from class Sub, the missing signatures are as follows. * For convenience, these are usable as stub implementations. * (First one before this commitw as 'def raw(x$1: M_1)' */ def raw(x$1: M_1[_ <: String]): Unit = ??? def raw(x$1: Any): Unit = ???
* | Concision contribution.Paul Phillips2013-05-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have lots of core classes for which we need not go through the symbol to get the type: ObjectClass.tpe -> ObjectTpe AnyClass.tpe -> AnyTpe I updated everything to use the concise/direct version, and eliminated a bunch of noise where places were calling typeConstructor, erasedTypeRef, and other different-seeming methods only to always wind up with the same type they would have received from sym.tpe. There's only one Object type, before or after erasure, with or without type arguments. Calls to typeConstructor were especially damaging because (see previous commit) it had a tendency to cache a different type than the type one would find via other means. The two types would compare =:=, but possibly not == and definitely not eq. (I still don't understand what == is expected to do with types.)