summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | Pattern matching virtualization now guarded by -Yvirtpatmat.Miles Sabin2016-11-281-1/+1
| |/ / /
* | | | Merge pull request #5554 from retronym/ticket/10009Adriaan Moors2016-11-292-4/+14
|\ \ \ \ | | | | | | | | | | SI-10009 Fields survive untypecheck/retypecheck
| * | | | SI-10009 Fields survive untypecheck/retypecheckJason Zaugg2016-11-282-4/+14
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #5506 from retronym/topic/existential-idsAdriaan Moors2016-11-291-1/+1
|\ \ \ \ | |_|/ / |/| | | Avoid name table pollution with fresh existentials
| * | | Avoid name table pollution with fresh existentialsJason Zaugg2016-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During large compilations runs, the large numbers of globally unique fresh names for existentials captured from prefixes of `asSeenFrom`. is a) somewhat wasteful (all these names are interned in the name table) , and, b) form a pathological case for the current implementation of `Names#hashValue`, which leads to overfull hash-buckets in the name table. `hashValue` should probably be improved, but my attempts to do so have shown a small performance degradation in some benchmarks. So this commit starts by being more frugal with these names, only uniquely naming within an `asSeenFrom` operation. References scala/scala-dev#246
* | | | SI-9945 Don't warn imports in java unitsSom Snytt2016-11-161-1/+1
| |/ / |/| | | | | | | | Scaladoc was prone to warning about java imports.
* | | Merge pull request #5449 from som-snytt/issue/9953Lukas Rytz2016-11-161-1/+1
|\ \ \ | | | | | | | | SI-9953 Any Any aborts warn on equals
| * | | SI-9953 Any Any aborts warn on equalsSom Snytt2016-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't warn about equals if any `Any` is involved. cf SI-8965 The condition for warning is that both types lub to a supertype of Object.
* | | | Typo and spelling correctionsJanek Bogucki2016-11-111-1/+1
| | | |
* | | | Merge pull request #5460 from som-snytt/issue/6978Jason Zaugg2016-11-101-1/+1
|\ \ \ \ | | | | | | | | | | SI-6978 No linting of Java parens
| * | | | SI-6978 No linting of Java parensSom Snytt2016-10-151-1/+1
| |/ / / | | | | | | | | | | | | | | | | Don't lint overriding of nullary by non-nullary when non-nullary is Java-defined. They can't help it.
* | | | SI-6734 CommentSom Snytt2016-10-311-1/+2
| | | |
* | | | SI-6734 Synthesize companion near case classSom Snytt2016-10-271-3/+17
| |/ / |/| | | | | | | | | | | | | | Tweak the "should I synthesize now" test for case modules, so that the tree is inserted in the same tree as the case class.
* | | SI-9516 remove now-unneeded codeSeth Tisue2016-10-241-3/+3
| | | | | | | | | | | | now that STARR includes the relevant fix
* | | Merge pull request #5393 from som-snytt/issue/nowarn-thistype-discardLukas Rytz2016-10-211-2/+7
|\ \ \ | | | | | | | | No warn when discarding r.f(): r.type
| * | | No warn when discarding r.f(): r.typeSom Snytt2016-09-101-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The paradigm is `def add(x: X): Unit = listBuffer += x`. The value that is discarded is not new information. Also cleans up the recent tweaks to help messaging. Adds newlines in case they ask for multiple helps.
* | | | Error message for super calls to indirect java parent interfacesLukas Rytz2016-09-301-2/+2
| |/ / |/| | | | | | | | | | | | | | | | | | | | Super calls to indirect java parent interfaces cannot be emitted, an error message is emitted during SuperAccessors. The error message was missing if the super call was non-qualified, resulting in an assertion failure in the backend.
* | | Make isSeparateCompiled... robust against rogue phase time travelJason Zaugg2016-09-271-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | We don't hit this code path during bootstrapping, but we could conceivably hit it with macros or compiler plugins peering into the future through atPhase before refchecks as run. Also rename a method to reflect the generality of the info transform (it does more than mixin, now.)
* | | SD-226 Be lazier in Fields info transform for better performanceJason Zaugg2016-09-211-0/+5
|/ / | | | | | | | | | | | | | | Only mixin fields + accessors into class infos of classes that are either in the current run, or appear in a superclass chain of a class in the current run. This is analagous to what happens in the mixin phase.
* | SD-143 allow super calls to methods defined in indirect super classesJason Zaugg2016-09-051-1/+7
| | | | | | | | | | | | | | | | The restriction for super calls to methods defined in indirect super classes introduced in a980fde was over-restrictive. In particular, it ruled out a valid code pattern to select a method from a superclass when an unqualified `super` would resolve to an override defined in a trait (example in the commit as a test).
* | Merge pull request #5369 from lrytz/sd210Lukas Rytz2016-09-022-2/+17
|\ \ | | | | | | Fixes to mixin forwarders
| * | SD-143 error for super calls that cannot be implemented correctlyLukas Rytz2016-09-012-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a call super[T].m resolves to a method A.m where A is a class, but not the direct superclass of the current class, there is no way to emit an invocation of A.m: `invokespecial A.m` will resolve to B.m where B is the superclass of the current class. This commit adds an error message in this case. Note that this is similar to an existing error message for qualified super calls to a non-direct superclass: class A { def m = 1 } class B extends A { override def m = 2 } class C extends B { override def m = super[A].m } Gives "error: A does not name a parent class of class C". If the user means to call method m in the superclass, he can write an unqualified `super.m`. An similar error message is introduced if A is a Java-defined interface (and m is a default method), and A is not a direct parent of the current class. In this case `invokespecial A.m` is invalid bytecode. The solution is to add A as a direct parent of the current class.
* | | Merge pull request #5294 from adriaanm/fields-laziesAdriaan Moors2016-09-017-335/+214
|\ \ \ | |/ / |/| | Fields: expand lazy vals during fields, like modules
| * | Fields does bitmaps & synch for lazy vals & modulesAdriaan Moors2016-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Essentially, we fuse mixin and lazyvals into the fields phase. With fields mixing in trait members into subclasses, we have all info needed to compute bitmaps, and thus we can synthesize the synchronisation logic as well. By doing this before erasure we get better signatures, and before specialized means specialized lazy vals work now. Mixins is now almost reduced to its essence: implementing super accessors and forwarders. It still synthesizes accessors for param accessors and early init trait vals. Concretely, trait lazy vals are mixed into subclasses with the needed synchronization logic in place, as do lazy vals in classes and methods. Similarly, modules are initialized using double checked locking. Since the code to initialize a module is short, we do not emit compute methods for modules (anymore). For simplicity, local lazy vals do not get a compute method either. The strange corner case of constant-typed final lazy vals is resolved in favor of laziness, by no longer assigning a constant type to a lazy val (see widenIfNecessary in namers). If you explicitly ask for something lazy, you get laziness; with the constant-typedness implicit, it yields to the conflicting `lazy` modifier because it is explicit. Co-Authored-By: Lukas Rytz <lukas@lightbend.com> Fixes scala/scala-dev#133 Inspired by dotc, desugar a local `lazy val x = rhs` into ``` val x$lzy = new scala.runtime.LazyInt() def x(): Int = { x$lzy.synchronized { if (!x$lzy.initialized) { x$lzy.initialized = true x$lzy.value = rhs } x$lzy.value } } ``` Note that the 2.11 decoding (into a local variable and a bitmap) also creates boxes for local lazy vals, in fact two for each lazy val: ``` def f = { lazy val x = 0 x } ``` desugars to ``` public int f() { IntRef x$lzy = IntRef.zero(); VolatileByteRef bitmap$0 = VolatileByteRef.create((byte)0); return this.x$1(x$lzy, bitmap$0); } private final int x$lzycompute$1(IntRef x$lzy$1, VolatileByteRef bitmap$0$1) { C c = this; synchronized (c) { if ((byte)(bitmap$0$1.elem & 1) == 0) { x$lzy$1.elem = 0; bitmap$0$1.elem = (byte)(bitmap$0$1.elem | 1); } return x$lzy$1.elem; } } private final int x$1(IntRef x$lzy$1, VolatileByteRef bitmap$0$1) { return (byte)(bitmap$0$1.elem & 1) == 0 ? this.x$lzycompute$1(x$lzy$1, bitmap$0$1) : x$lzy$1.elem; } ``` An additional problem with the above encoding is that the `lzycompute` method synchronizes on `this`. In connection with the new lambda encoding that no longer generates anonymous classes, captured lazy vals no longer synchronize on the lambda object. The new encoding solves this problem (scala/scala-dev#133) by synchronizing on the lazy holder. Currently, we don't exploit the fact that the initialized field is `@volatile`, because it's not clear the performance is needed for local lazy vals (as they are not contended, and as soon as the VM warms up, biased locking should deal with that) Note, be very very careful when moving to double-checked locking, as this needs a different variation than the one we use for class-member lazy vals. A read of a volatile field of a class does not necessarily impart any knowledge about a "subsequent" read of another non-volatile field of the same object. A pair of volatile reads and write can be used to implement a lock, but it's not clear if the complexity is worth an unproven performance gain. (Once the performance gain is proven, let's change the encoding.) - don't explicitly init bitmap in bytecode - must apply method to () explicitly after uncurry
| * | SI-8873 don't propagate primary ctor arg to case class's applyAdriaan Moors2016-08-292-0/+12
| | | | | | | | | | | | Final implementation based on feedback by Jason
| * | Fields phase expands lazy vals like modulesAdriaan Moors2016-08-296-339/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Ensure trait var accessor type is widenedAdriaan Moors2016-08-291-1/+2
|/ / | | | | | | | | | | | | | | | | | | If we don't widen, we'll fail to find the setter when typing `x = 42`, because `x` is constant-folded to `0`, as its type is `=> Int(0)`. After widening, `x` is type checked to `x` and its symbol is the getter in the trait, which can then be rewritten to the setter. Regression spotted and test case by szeiger.
* | Merge pull request #5263 from retronym/review/5041Jason Zaugg2016-08-291-6/+13
|\ \ | | | | | | SI-5294 SI-6161 Hard graft in asSeenFrom, refinements, and existentials [ci: last-only]
| * | 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.
* | | SAM for subtypes of FunctionNLukas Rytz2016-08-261-1/+1
|/ / | | | | | | | | | | | | | | | | | | only exclude FunctionN types themselves from SAM, don't exclude their subtypes; we want e.g. trait T extends Function1[String, String] (x => x) : T to compile reference: https://github.com/scala/scala-dev/issues/206
* | Merge pull request #5266 from som-snytt/issue/9847Adriaan Moors2016-08-141-8/+33
|\ \ | | | | | | SI-9847 Nuance pure expr statement warning
| * | SI-9847 Nuance pure expr statement warningSom Snytt2016-07-081-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarify the current warning, which means that an expression split over multiple lines may not be parsed as naively expected. When typing a block, attempt minor nuance. For instance, a single expression is not in need of parens. Try to avoid duplicate warnings for expressions that were adapted away from result position.
* | | Merge pull request #5307 from adriaanm/issue-157Adriaan Moors2016-08-132-28/+61
|\ \ \ | | | | | | | | Propagate overloaded function type to expected arg type
| * | | Propagate overloaded function type to expected arg typeAdriaan Moors2016-08-122-28/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Infer missing parameter types for function literals passed to higher-order overloaded methods by deriving the expected argument type from the function types in the overloaded method type's argument types. This eases the pain caused by methods becoming overloaded because SAM types and function types are compatible, which used to disable parameter type inference because for overload resolution arguments are typed without expected type, while typedFunction needs the expected type to infer missing parameter types for function literals. It also aligns us with dotty. The special case for function literals seems reasonable, as it has precedent, and it just enables the special case in typing function literals (derive the param types from the expected type). Since this does change type inference, you can opt out using the Scala 2.11 source level. Fix scala/scala-dev#157
* | | | Merge pull request #5332 from retronym/review/5304Adriaan Moors2016-08-133-3/+22
|\ \ \ \ | | | | | | | | | | Fixes to Java source support in Scaladoc
| * | | | 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
| * | | | Javadoc: java static name resolutionAdriaan Moors2016-08-132-2/+21
| |/ / / | | | | | | | | | | | | [Jakob Odersky <jodersky@gmail.com>: remove obsolete comments and fix tests]
* / / / SD-128 fix override checks for default methodsLukas Rytz2016-08-121-2/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for inheriting two conflicting members was wrong for default methods, leading to a missing error message. We were also not issuing "needs `override' modifier" when overriding a default method. Removes two methods: - `isDeferredOrJavaDefault` had a single use that is removed in this commit. - `isDeferredNotJavaDefault` is redundant with `isDeferred`, because no default method has the `DEFERRED` flag: - For symbols originating in the classfile parser this was the case from day one: default methods don't receive the `DEFERRED` flag. Only abstract interface methods do, as they have the `JAVA_ACC_ABSTRACT` flag in bytecode, which the classfile parser translates to `DEFERRED`. - For symbols created by the Java source parser, we don't add the `DEFERRED` to default methods anymore since 373db1e. Fixes scala/scala-dev#128
* | | Merge pull request #5252 from adriaanm/t8339Stefan Zeiger2016-08-122-15/+2
|\ \ \ | | | | | | | | SI-8339 remove deprecated rewrite of withFilter -> filter
| * | | SI-8339 drop deprecated fallback `withFilter` -> `filter`Adriaan Moors2016-08-112-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | You must implement the `withFilter` method to use `if`-guards in a `for`-comprehension. (Drop pos/t7239.scala because it relied on this rewrite.)
* | | | Merge pull request #5141 from adriaanm/fieldsAdriaan Moors2016-08-117-779/+723
|\ \ \ \ | | | | | | | | | | Introducing: the fields phase [ci: last-only]
| * | | | Review feedback from Jason & LukasAdriaan Moors2016-08-111-1/+1
| | | | |
| * | | | Drive accessor synthesis from info transformerAdriaan Moors2016-08-113-453/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | Admit @volatile on accessor in traitAdriaan Moors2016-08-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no other place to squirrel away the annotation until we create a field in a subclass. The test documents the idea, but does not capture the regression seen in the wild, as explained in a comment.
| * | | | Allow 'overriding' deferred varAdriaan Moors2016-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | Discovered by scala-js's test suite.
| * | | | Align double definition check with specAdriaan Moors2016-08-111-20/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove weird special cases for private-local fields and parameter accessor (fields). One change with the new trait val encoding: ``` scala> trait T { private[this] var x: String = "1" ; def x(): Int = 1 } <console>:11: error: method x is defined twice; the conflicting variable x was defined at line 11:37 trait T { private[this] var x: String = "1" ; def x(): Int = 1 } ^ ``` Whereas: ``` scala> class T { private[this] var x: String = "1" ; def x(): Int = 1 } defined class T ``` Before, both the `class` and `trait` definition were accepted. (Because there is no accessor for a private[this] val/var, and a MethodType does not match the type of a value.) (Dotty accepts neither the class or the trait definition.)
| * | | | LambdaLift emits paramaccessor syms and defdefsAdriaan Moors2016-08-111-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... instead of emitting ValDefs and field symbols, which are then promptly unlinked and transformed by the "late trait methods" logic in mixins... Mixins still synthesizes implementations for these accessors in subclasses. A paramaccessor in a trait is a method without an underlying field.
| * | | | Address lrytz's review feedbackAdriaan Moors2016-08-112-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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...
| * | | | Uncurry's info transform: non-static module --> methodAdriaan Moors2016-08-111-24/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do this during uncurry so we can insert the necessary applications to the empty argument list. Fields is too late. Refchecks is no longer an info transform.
| * | | | Fields phase synthesizes modulesAdriaan Moors2016-08-111-68/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For now, keep the info transform in refchecks. Ultimately, refchecks should only check, not transform trees/infos. Fixes https://github.com/scala/scala-dev/issues/126: the accessor for a module in a trait is correctly marked non-final (it's deferred).