summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
Commit message (Collapse)AuthorAgeFilesLines
* Revert some of ade53a123. Use completer factory methods.Adriaan Moors2017-04-111-7/+7
| | | | | | | Scalameta et al need to be able to customize the type completer behavior, so we must use factory methods to instantiate them, rather than instantiating the classes directly.
* Boy scout mkTypeCompleterAdriaan Moors2017-04-061-7/+7
| | | | | Create named subclasses, preserve factory methods for external users. Make explicit that TypeCompleterBase is not meant for wrapping.
* Use CompleterWrapper for implicitFactoryMethodCompleterAdriaan Moors2017-04-061-1/+1
| | | | | mkTypeCompleter is not suitable for wrapping potentially polymorphic completers
* Refactor to reduce assignSymbol indirectionAdriaan Moors2017-04-061-1/+1
| | | | | | - remove logging wrapper that also does important work - `assignAndEnterSymbol(tree)` --> `enterInScope(assignMemberSymbol(tree))` - reduce redundant type test (we know it's an import/package/member)
* SI-10009 Fields survive untypecheck/retypecheckJason Zaugg2016-11-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some places in the compiler, and many places in macros, use `untypecheck` (aka `resetAttrs`) to strip types and local symbols from a tree before retypechecking it under some different context. The refactoring of the desugaring of vals and vars in Scala 2.12.0 broke an assumption in this facility. When a ValDef must be split into multiple members (e.g. a field and a getter, or a perhaps also a setter), the ValDef that was parsed assumes the role of the `field`, and the trees for other members are stached by `Namer` to the `synthetics` map of the compilation unit, in order to spliced into the right statement list by typechecking. See `enterGetterSetter` for more details. However, the parsed ValDef is now used verbatim, carrying the meaning (ie, the symbol) of the `private[this]` field. This tree now had an inconsistency between the flags in `tree.mods.flags` and `tree.symbol.flags`. `tree.name` also differed from `tree.symbol.name` (the latter was renamed to be a local name, ie one with a trailing space.) When `ResetAttrs` stripped off the symbol and we retypechecked, we'd end up with two symbols in scope with the same name. In the first from the `run` test: ``` ================================================================================ { class a extends scala.AnyRef { def <init>(): a = { a.super.<init>(); () }; private[this] val x: Int = 42; <stable> <accessor> def x: Int = a.this.x }; new a() } { class a extends scala.AnyRef { def <init>() = { super.<init>(); () }; val x = 42; // oops, the name is "x" rather than "x " and we've missing `private[this]`! <stable> <accessor> def x: Int = a.this.x }; new a() } scala.tools.reflect.ToolBoxError: reflective typecheck has failed: x is already defined as value x ``` This commit uses the flags and name of the symbol in `typedValDef`. I've also had to modify the internals of `CodePrinter` to use the implicit, override, and deferred flags from the modifiers of an accessor when recovering pre-typer tree for a ValDef.
* Fields phase expands lazy vals like modulesAdriaan Moors2016-08-291-221/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They remain ValDefs until then. - remove lazy accessor logic now that we have a single ValDef for lazy vals, with the underlying machinery being hidden until the fields phase leave a `@deprecated def lazyAccessor` for scala-refactoring - don't skolemize in purely synthetic getters, but *do* skolemize in lazy accessor during typers Lazy accessors have arbitrary user code, so have to skolemize. We exempt the purely synthetic accessors (`isSyntheticAccessor`) for strict vals, and lazy accessors emitted by the fields phase to avoid spurious type mismatches due to issues with existentials (That bug is tracked as https://github.com/scala/scala-dev/issues/165) When we're past typer, lazy accessors are synthetic, but before they are user-defined to make this hack less hacky, we could rework our flag usage to allow for requiring both the ACCESSOR and the SYNTHETIC bits to identify synthetic accessors and trigger the exemption. see also https://github.com/scala/scala-dev/issues/165 ok 7 - pos/existentials-harmful.scala ok 8 - pos/t2435.scala ok 9 - pos/existentials.scala previous attempt: skolemize type of val inside the private[this] val because its type is only observed from inside the accessor methods (inside the method scope its existentials are skolemized) - bean accessors have regular method types, not nullary method types - must re-infer type for param accessor some weirdness with scoping of param accessor vals and defs? - tailcalls detect lazy vals, which are defdefs after fields - can inline constant lazy val from trait - don't mix in fields etc for an overridden lazy val - need try-lift in lazy vals: the assign is not seen in uncurry because fields does the transform (see run/t2333.scala) - ensure field members end up final in bytecode - implicit class companion method: annot filter in completer - update check: previous error message was tangled up with unrelated field definitions (`var s` and `val s_scope`), now it behaves consistently whether those are val/vars or defs - analyzer plugin check update seems benign, but no way to know... - error message gen: there is no underlying symbol for a deferred var look for missing getter/setter instead - avoid retypechecking valdefs while duplicating for specialize see pos/spec-private - Scaladoc uniformly looks to field/accessor symbol - test updates to innerClassAttribute by Lukas
* Type#contains should peer into RefinementTypeRef-sJason Zaugg2016-08-191-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually, `contains` should not look into class symbol infos. For instance, we expect that: ``` scala> trait C { def foo: Int }; typeOf[C].contains(IntClass) defined trait C res1: Boolean = false ``` We do, however, look at the decls of a `RefinedType` in contains: ``` scala> typeOf[{ def foo: Int }].contains(IntClass) res2: Boolean = true ``` Things get a little vague, however, when we consider a type ref to the refinement class symbol of a refined type. ``` scala> TypeRef(NoPrefix, typeOf[{ def foo: Int }].typeSymbol, Nil) res3: $r.intp.global.Type = AnyRef{def foo: Int} scala> .contains(IntClass) res4: Boolean = false ``` These show up in the first element of the base type seq of a refined type, e.g: ``` scala> typeOf[{ def foo: Int }].typeSymbol.tpe_* res5: $r.intp.global.Type = AnyRef{def foo: Int} scala> typeOf[{ def foo: Int }].baseTypeSeq(0).getClass res7: Class[_ <: $r.intp.global.Type] = class scala.reflect.internal.Types$RefinementTypeRef scala> typeOf[{ def foo: Int }].typeSymbol.tpe_*.getClass res6: Class[_ <: $r.intp.global.Type] = class scala.reflect.internal.Types$RefinementTypeRef ``` This commit takes the opinion that a `RefinementTypeRef` should be transparent with respect to `contains`. This paves the way for fixing the base type sequences of existential types over refinement types. The implementation of `ContainsCollector` was already calling `normalize`, which goes from `RefinementTypeRef` to `RefinedType`. This commit maps over the result, which looks in the parents and decls.
* Javadoc: fix problems in community buildJakob Odersky2016-08-131-1/+1
| | | | | | | - fix initialization NPE in doc headers - fix assertion errors for java fields - ignore comments when deciding where to put interface methods - consider DocDefs when checking for constructors
* Review feedback from Jason & LukasAdriaan Moors2016-08-111-1/+1
|
* Drive accessor synthesis from info transformerAdriaan Moors2016-08-111-357/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | Derive/filter/propagate annotations in info transformer, don't rely on having type checked the derived trees in order to see the annotations. Use synthetics mechanism for bean accessors -- the others will soon follow. Propagate inferred tpt from valdef to accessors by setting type in right spot of synthetic tree during the info completer. No need to add trees in derivedTrees, and get rid of some overfactoring in method synthesis, now that we have joined symbol and tree creation. Preserve symbol order because tests are sensitive to it. Drop warning on potentially discarded annotations, I don't think this warrants a warning. Motivated by breaking the scala-js compiler, which relied on annotations appearing when trees are type checked. Now that ordering constraint is gone in the new encoding, we may as well finally fix annotation assignment.
* Address lrytz's review feedbackAdriaan Moors2016-08-111-3/+10
| | | | | | | | | | | | | Remove obsolete hack for BeanSetter's RHS Use currentOwner.isClass instead of exprOwner.isLocalDummy Refactor: shortest branches first in if/else Fix comments from when the prototype ran before refchecks Also, store `isScala212` as a `val` in `Namer` since the `def` on `settings` parses the version each time...
* Fields phaseAdriaan Moors2016-08-111-18/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One step towards teasing apart the mixin phase, making each phase that adds members to traits responsible for mixing in those members into subclasses of said traits. Another design tenet is to not emit symbols or trees only to later remove them. Therefore, we model a val in a trait as its accessor. The underlying field is an implementation detail. It must be mixed into subclasses, but has no business in a trait (an interface). Also trying to reduce tree creation by changing less in subtrees during tree transforms. A lot of nice fixes fall out from this rework: - Correct bridges and more precise generic signatures for mixed in accessors, since they are now created before erasure. - Correct enclosing method attribute for classes nested in trait fields. Trait fields are now created as MethodSymbol (no longer TermSymbol). This symbol shows up in the `originalOwner` chain of a class declared within the field initializer. This promoted the field getter to being the enclosing method of the nested class, which it is not (the EnclosingMethod attribute is a source-level property). - Signature inference is now more similar between vals and defs - No more field for constant-typed vals, or mixed in accessors for subclasses. A constant val can be fully implemented in a trait. TODO: - give same treatment to trait lazy vals (only accessors, no fields) - remove support for presuper vals in traits (they don't have the right init semantics in traits anyway) - lambdalift should emit accessors for captured vals in traits, not a field Assorted notes from the full git history before squashing below. Unit-typed vals: don't suppress field it affects the memory model -- even a write of unit to a field is relevant... unit-typed lazy vals should never receive a field this need was unmasked by test/files/run/t7843-jsr223-service.scala, which no longer printed the output expected from the `0 to 10 foreach` Use getter.referenced to track traitsetter reify's toolbox compiler changes the name of the trait that owns the accessor between fields and constructors (`$` suffix), so that the trait setter cannot be found when doing mkAssign in constructors this could be solved by creating the mkAssign tree immediately during fields anyway, first experiment: use `referenced` now that fields runs closer to the constructors phase (I tried this before and something broke) Infer result type for `val`s, like we do for `def`s The lack of result type inference caused pos/t6780 to fail in the new field encoding for traits, as there is no separate accessor, and method synthesis computes the type signature based on the ValDef tree. This caused a cyclic error in implicit search, because now the implicit val's result type was not inferred from the super member, and inferring it from the RHS would cause implicit search to consider the member in question, so that a cycle is detected and type checking fails... Regardless of the new encoding, we should consistently infer result types for `def`s and `val`s. Removed test/files/run/t4287inferredMethodTypes.scala and test/files/presentation/t4287c, since they were relying on inferring argument types from "overridden" constructors in a test for range positions of default arguments. Constructors don't override, so that was a mis-feature of -Yinfer-argument-types. Had to slightly refactor test/files/presentation/doc, as it was relying on scalac inferring a big intersection type to approximate the anonymous class that's instantiated for `override lazy val analyzer`. Now that we infer `Global` as the expected type based on the overridden val, we make `getComment` private in navigating between good old Skylla and Charybdis. I'm not sure why we need this restriction for anonymous classes though; only structural calls are restricted in the way that we're trying to avoid. The old behavior is maintained nder -Xsource:2.11. Tests: - test/files/{pos,neg}/val_infer.scala - test/files/neg/val_sig_infer_match.scala - test/files/neg/val_sig_infer_struct.scala need NMT when inferring sig for accessor Q: why are we calling valDefSig and not methodSig? A: traits use defs for vals, but still use valDefSig... keep accessor and field info in synch
* General cleanups and less warnings during a Scala buildsoc2016-04-041-2/+0
|
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-4/+3
| | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* Annotation filtering & derivation in one place.Adriaan Moors2015-11-121-34/+31
| | | | | This logic was scattered all over the hierarchy, even though it's only needed in one spot, and is unlikely to evolve.
* Revert suspicious widening of getter's result typeAdriaan Moors2015-11-111-4/+5
|
* Review feedback from retronymAdriaan Moors2015-09-021-2/+3
|
* Simplify decision whether to derive accessorsAdriaan Moors2015-09-021-10/+3
| | | | | | | | | | | | | | | | | | | | | Originally (modulo renaming & reduction of double negation in previous commit): ``` def deriveAccessors(vd: ValDef) = vd.mods.isLazy || !( !owner.isClass || (vd.mods.isPrivateLocal && !vd.mods.isCaseAccessor) // this is an error -- now checking first || (vd.name startsWith nme.OUTER) || (context.unit.isJava) // pulled out to caller || isEnumConstant(vd) ) def deriveAccessorTrees(vd: ValDef) = !( (vd.mods.isPrivateLocal && !vd.mods.isLazy) // lazy was pulled out to outer disjunction || vd.symbol.isModuleVar // pulled out to caller || isEnumConstant(vd)) ``` With changes in comments above, these conditions are now captured by one method.
* Streamline MethodSynthesis & NamersAdriaan Moors2015-09-021-50/+77
| | | | | | | | | Give Getter control over whether a setter is needed. For now, only mutable ValDefs entail setters. In the new trait encoding, a trait val will also receive a setter from the start. Similarly, distinguish whether to derive a field from deferredness of the val. (Later, fields will not be emitted for traits, deferred or not.)
* Fix 25 typos (s)Janek Bogucki2015-07-061-1/+1
|
* Removed warningsEECOLOR2015-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | - Added `since` to deprecation statement - Added unit to parameter list - Removed usage of deprecated method polyType - Replaced deprecated `debugwarn` with `devWarning` - Changed switch statement to if else in order to remove a warning - Switched implementation of `init` and `processOptions` to prevent warning - Replaced deprecated `Console.readLine` with `scala.io.StdIn.readLine` - Replaced deprecated `startOrPoint` with `start` - Replaced deprecated `tpe_=` with `setType` - Replaced deprecated `typeCheck` with `typecheck` - Replaced deprecated `CompilationUnit.warning` with `typer.context.warning` - Replaced deprecated `scala.tools.nsc.util.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader` - Replaced deprecated `scala.tools.ListOfNil` with `scala.reflect.internal.util.ListOfNil` - Replaced deprecated `scala.tools.utils.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader` - Replaced deprecated `emptyValDef` with `noSelfType` - In `BoxesRunTime` removed unused method and commented out unused values. Did not delete to keep a reference to the values. If they are deleted people might wonder why `1` and `2` are not used. - Replaced deprecated `scala.tools.nsc.util.AbstractFileClassLoader` with `scala.reflect.internal.util.AbstractFileClassLoader`
* Deprecations: Use of isPackage, hasSymbol, getter, setter...Simon Ochsenreither2015-03-261-2/+2
| | | | ... replaced by hasPackageFlag, hasSymbolIn, getterIn, setterIn.
* SI-8941 Idempotent presentation compilation of implicit classesJason Zaugg2014-10-281-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we name an implicit class, `enterImplicitWrapper` is called, which enters the symbol for the factory method into the owning scope. The tree defining this factory method is stowed into `unit.synthetics`, from whence it will be retrieved and incorporated into the enclosing tree during typechecking (`addDerivedTrees`). The entry in `unit.synthetics` is removed at that point. However, in the presentation compiler, we can typecheck a unit more than once in a single run. For example, if, as happens in the enclosed test, a call to ask for a type at a given position interrupts type checking of the entire unit, we can get into a situation whereby the first type checking invocation has consumed the entry from `unit.synthetics`, and the second will crash when it can't find an entry. Similar problems have been solved in the past in `enterExistingSym` in the presentation compiler. This method is called when the namer encounters a tree that already has a symbol attached. See 0b78a0196 / 148736c3df. This commit takes a two pronged approach. First, `enterExistingSym` is extended to handle implicit classes. Any previous factory method in the owning scope is removed, and `enterImplicitWrapper` is called to place a new tree for the factory into `unit.synthetics` and to enter its symbol into the owning scope. Second, the assertions that could be tripped in `addDerivedTrees` and in `ImplicitClassWrapper#derivedSym` have been converted to positioned errors. The first change is sufficient to fix this bug, but the second is also enough to make the enclosed test pass, and has been retained as an extra layer of defence.
* Optimization: use AnyRef map for Namer -> Typer tree handoffJason Zaugg2014-02-091-1/+1
| | | | | | | | And uses a map per-compilation unit, rather than one per Typer. One small change required: we now need to clear this map in the the interactive compiler which reuses compilation units, rather than in the call to `Typer#reset`.
* Reducing variation of tree creation methods.Paul Phillips2013-09-131-55/+26
| | | | | | | | | | | | | | | | | | | | | | | TreeDSL has no future - it was always a temporary measure waiting for something like quasiquotes to come along. In this commit I cull as much of it as I can, especially the delicate matter of creating new DefDefs and ValDefs, which I completely turn over to the old style creators. I unified all the symbol-based DefDef and ValDef creators under a single method, since it was yet another place where ctrl-C and ctrl-V were being punched with glee. Was beaten to the punch on adding copyTypeDef to fill out the *Def creators. Eliminated as many redundant positioning calls as I could find. If you are creating a DefTree tree based on a symbol, it will always have an atPos(sym.pos) { ... } wrapped around it. You don't need another one. All of this is motivated by positions work: positions are assigned in so many places and in such an ad hoc fashion that it is impossible to bring consistency to that without first bringing some consistency to tree creation.
* Corrects behavior of finalResultType.Paul Phillips2013-09-131-1/+1
| | | | | | | | | | | | The implementation had come to depend on finalResultType accidentally doing things beyond its charter - in particular, widening types. After hunting down and fixing the call sites depending on the bugs, I was able to rewrite the method to do only what it's supposed to do. I threw in a different way of writing it entirely to suggest how some correctness might be obtained in the future. It's a lot harder for a method written like this to break.
* Eliminate TypeTrees with null original.Paul Phillips2013-09-041-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a retry of #2801 after figuring out the range position error. Should there be anyone out there who compiles with -Xdev, know that this commit eliminates the 1406 errors one presently incurs compiling src/library. A val declared in source code receives only one tree from the parser, but two are needed - one for the field and one for the getter. I discovered long ago that if the val had an existential type, this was creating issues with incompatible existentials between the field and the getter. However the remedy for that did not take into account the whole of the wide range of super subtle issues which accompany tree duplication. In particular, the duplicated tree must be given not only a fresh TypeTree(), but that TypeTree cannot share the same original without running afoul of range position invariants. That's because typedTypeTree resurrects the original tree with whatever position it has - so the "original" needs to be a duplicate of the original with a focused position. Should the call to TypeTree.duplicate also duplicate the original? I think so, but I bequeath this question to others. This commit also eliminated some duplicate error messages, because duplicate suppression depends on the errors having the same position. See c478eb770d, 7a6fa80937 for previous related work.
* Cleanups in Unapplies.Paul Phillips2013-08-171-2/+2
|
* Seals some case class hierarchies.Lex Spoon2013-06-261-8/+8
|
* Make all numeric coercions explicit.Paul Phillips2013-05-271-1/+1
| | | | | | | | | | | | | Optimistically, this is preparation for a day when we don't let numeric types drift with the winds. Even without the optimism it's a good idea. It flushed out an undocumented change in the math package object relative to the methods being forwarded (a type is widened from what is returned in java) so I documented the intentionality of it. Managing type coercions manually is a bit tedious, no doubt, but it's not tedious enough to warrant abandoning type safety just because java did it.
* Concision contribution.Paul Phillips2013-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | 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.)
* Overhauled local/getter/setter name logic.Paul Phillips2013-03-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sifted through extraneous methods trying to find consistency, consolidating and deprecating as I went. The original motivation for all this was the restoration of LOCAL_SUFFIX to originalName, because: It looks like in an attempt to make originalName print consistently with decodedName, I went a little too far and stripped invisible trailing spaces from originalName. This meant outer fields would have an originalName of '$outer' instead of '$outer ', which in turn could have caused them to be mis-recognized as outer accessors, because the logic of outerSource hinges upon "originalName == nme.OUTER". I don't know if this affected anything - I noticed it by inspection, improbably enough. Deprecated originalName - original, compared to what? - in favor of unexpandedName, which has a more obvious complement. Introduced string_== for the many spots where people have given up and are comparing string representations of names. A light dusting of types is still better than nothing. Editoral note: LOCAL_SUFFIX is the worst. Significant trailing whitespace! It's a time bomb.
* Remove -Xcheck-null setting.Paul Phillips2013-03-131-1/+1
| | | | | | | | | | Maybe this was useful in some way; but no way I ever saw. I have comments which tell me this is exposed in the IDE so I left a stub. I also removed mkCheckInit. That probably sounds like it's related to -Xcheckinit. Guess again, guy-who-thinks-names-mean-things. It was only used by -Xcheck-null.
* Merge commit '81d8f9d3da' into merge-210Paul Phillips2013-02-091-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * excluded from merge: [nomerge] SI-6667 Demote a new ambiguity error to a lint warning. Revert "SI-6422: add missing Fractional and Integral alias in scala package" [backport] SI-6482, lost bounds in extension methods. * commit '81d8f9d3da': (31 commits) reflecting @throws defined in Scala code pullrequest feedback SI-5833 Fixes tail-of-Nil problem in RefinedType#normalizeImpl SI-6017 Scaladoc: Show all letters without dangling links SI-6017 Generate Scaladoc's index links in Scala side SI-5313 Minor code cleanup for store clobbering SI-5313 Test clobbers on the back edge of a loop SI-7033 Be symful when creating factory methods. SI-7022 Additional test case for value class w. bounds SI-7039 unapplySeq result type independent of subpattern count evicts javac-artifacts.jar SI-7008 @throws annotations are now populated in reflect Fix SI-6578. Deprecated `askType` because of possible race conditions in type checker. SI-7029 - Make test more robust SI-7029 - Makes sure that uncaught exceptions are propagated to the UEH for the global ExecutionContext SI-6941 tests SI-6686 drop valdef unused in flatMapCond's block ... Conflicts: src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala src/reflect/scala/reflect/internal/Definitions.scala
| * Merge pull request #1992 from retronym/ticket/7033Adriaan Moors2013-02-041-1/+1
| |\ | | | | | | SI-7033 Be symful when creating factory methods.
| | * SI-7033 Be symful when creating factory methods.Jason Zaugg2013-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit class factory methods were synthesizing the reference to the class as `Ident(classDef.name)`, which was unhygienic in case of `implicit class X[X]`. To use symbols without causing a cycle, I switched from `REF(symbol)` to `Ident(symbol)`. The former calls into: at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:184) at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:124) at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:130) at scala.tools.nsc.ast.TreeDSL$CODE$.REF(TreeDSL.scala:307) which forces the info of enclosing module and forms a cycle.
* | | Merge commit 'f3cdf146709e0dd98533ee77e8ca2566380cb932'Lukas Rytz2013-02-041-2/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala src/reflect/scala/reflect/internal/AnnotationCheckers.scala src/reflect/scala/reflect/internal/Symbols.scala
| * | SI-1803, plus documentation and cleanups in Namers, mainly in typeSigLukas Rytz2013-02-031-2/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - when typing (and naming) a ValDef, tpt and rhs are now type checked in the same context (the inner / ValDef context). this does not change any behavior, but is more uniform (same as for DefDef). martin told me (offline) that this change is desirable if it doesn't break anything. (it doesn't). - typeSig is now more uniform with a separate method for each case (methodSig, valDefSig, etc). methodSig was cleaned up (no more variables) and documented. the type returned by methodSig no longer contains / refers to type skolems, but to the actual type parameters (so we don't need to replace the skolems lateron). - documentation on constructor contexts, type skolems - more tests for SI-5543
* | Tweaked meta-annotation error based on feedback.Paul Phillips2013-01-141-4/+5
| |
* | SI-6375, warn on lost annotation.Paul Phillips2013-01-141-2/+33
| | | | | | | | | | | | | | Annotations on abstract vals which are not meta-annotated were silently discarded. Still discarded, only less silently. I warned on as many "lost annotation" situations as I was reasonably able to cover without false positives.
* | Cleanup in module var creation.Paul Phillips2012-12-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | When all the logic in a method is for symbol creation, and then at the last minute it throws on a hastily zipped ValDef, it's really not a tree generation method, it's a symbol creation method. Eliminated redundancy and overgeneralization; marked some bits for further de-duplication. Did my best with my limited archeological skills to document what is supposed to be happening in eliminateModuleDefs.
* | Merge commit 'refs/pull/1718/head' into merge-msil-genjvm-deletePaul Phillips2012-12-061-5/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1718/head': Expunged the .net backend. Conflicts: build.detach.xml build.examples.xml build.xml project/Build.scala src/compiler/scala/tools/ant/Scalac.scala src/compiler/scala/tools/nsc/Global.scala src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala src/compiler/scala/tools/nsc/transform/Mixin.scala src/intellij/compiler.iml.SAMPLE tools/buildcp
| * | Expunged the .net backend.Paul Phillips2012-12-051-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | It lives on in a branch born from this commit's parent. It's abrupt; no attempt is made to offer a "smooth transition" for the serious msil userbase, population zero. If anyone feels very strongly that such a transition is necessary, I will be happy to talk you into feeling differently.
* | | Remove Name -> TermName implicit.Paul Phillips2012-12-011-3/+5
|/ / | | | | | | And simplify the name implicits.
* | Merge branch 'merge-2.10.wip-x' into merge-2.10.x-masterPaul Phillips2012-11-231-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * merge-2.10.wip-x: (24 commits) SI-6023 reify abstract vals Removing controversial `either` method from Futures API. SI-6695 Test case for fixed Array match bug adds comments to standard attachments SI-6673 fixes macro problems with eta expansions Restore the opimization apparently lost after merge. SI-6624 set info of case pattern binder to help find case field accessors Scaladoc update for collection.mutable.MultiMap SI-6663: don't ignore type parameter on selectDynamic invocation SI-6551: don't insert apply call in polymorphic expression. SI-6634 Fixes data corruption issue in ListBuffer#remove Fixes SI-6628, Revert "Fix for view isEmpty." SI-6661 - Remove obsolete implicit parameter of scala.concurrent.promise method Fixes SI-6150 - backport to 2.10.x branch. SI-5330, SI-6014 deal with existential self-type Fixes SI-6559 - StringContext not using passed in escape function. SI-6648 copyAttrs must preserve TypeTree#wasEmpty Fix raw string interpolator: string parts which were after the first argument were still escaped sane printing of renamed imports SI-6440 Address regressions around MissingRequirementError ... Conflicts: src/library/scala/collection/generic/IndexedSeqFactory.scala src/library/scala/collection/mutable/ListBuffer.scala src/reflect/scala/reflect/internal/Symbols.scala src/reflect/scala/reflect/internal/Types.scala test/files/run/t6150.scala
| * SI-6023 reify abstract valsYour Name2012-11-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | Type trees created by MethodSynthesis for abstract val getters carry symless originals, which are unusable for reification purposes (or the result of reification will be unhygienic). To combat this, type trees for such getters are now created empty, i.e. without any `tpe` set, just having an original assigned. Subsequent `typedTypeTree` invocations fill in the `tpe` and update the original to be symful.
* | Removed code from the typechecker.Paul Phillips2012-11-201-67/+15
| | | | | | | | | | Removing code from this neighborhood is more difficult than elsewhere, making it all the more important that it be done.
* | Revert "Commenting out unused members."Paul Phillips2012-11-191-35/+35
| | | | | | | | This reverts commit 951fc3a486.
* | Commenting out unused members.Paul Phillips2012-11-191-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I want to get this commit into the history because the tests pass here, which demonstrates that every commented out method is not only unnecessary internally but has zero test coverage. Since I know (based on the occasional source code comment, or more often based on knowing something about other source bases) that some of these can't be removed without breaking other things, I want to at least record a snapshot of the identities of all these unused and untested methods. This commit will be reverted; then there will be another commit which removes the subset of these methods which I believe to be removable. The remainder are in great need of tests which exercise the interfaces upon which other repositories depend.
* | Removed unused imports.Paul Phillips2012-11-061-2/+1
| | | | | | | | | | | | | | | | | | A dizzying number of unused imports, limited to files in src/compiler. I especially like that the unused import option (not quite ready for checkin itself) finds places where feature implicits have been imported which are no longer necessary, e.g. this commit includes half a dozen removals of "import scala.language.implicitConversions".