File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed
src/dotty/tools/dotc/core Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ object Contexts {
282
282
* from constructor parameters to class paramater accessors.
283
283
*/
284
284
def superCallContext : Context = {
285
- val locals = newScopeWith(owner.decls.filter(_ is ParamAccessor ).toList : _* )
285
+ val locals = newScopeWith(owner.asClass.paramAccessors : _* )
286
286
superOrThisCallContext(owner.primaryConstructor, locals)
287
287
}
288
288
Original file line number Diff line number Diff line change @@ -676,6 +676,7 @@ object Denotations {
676
676
// ------ PreDenotation ops ----------------------------------------------
677
677
678
678
final def first = this
679
+ final def last = this
679
680
final def toDenot (pre : Type )(implicit ctx : Context ): Denotation = this
680
681
final def containsSym (sym : Symbol ): Boolean = hasUniqueSym && (symbol eq sym)
681
682
final def containsSig (sig : Signature )(implicit ctx : Context ) =
@@ -761,8 +762,9 @@ object Denotations {
761
762
/** A denotation in the group exists */
762
763
def exists : Boolean
763
764
764
- /** First denotation in the group */
765
+ /** First/last denotation in the group */
765
766
def first : Denotation
767
+ def last : Denotation
766
768
767
769
/** Convert to full denotation by &-ing all elements */
768
770
def toDenot (pre : Type )(implicit ctx : Context ): Denotation
@@ -827,6 +829,7 @@ object Denotations {
827
829
assert(denots1.exists && denots2.exists, s " Union of non-existing denotations ( $denots1) and ( $denots2) " )
828
830
def exists = true
829
831
def first = denots1.first
832
+ def last = denots2.last
830
833
def toDenot (pre : Type )(implicit ctx : Context ) =
831
834
(denots1 toDenot pre) & (denots2 toDenot pre, pre)
832
835
def containsSym (sym : Symbol ) =
Original file line number Diff line number Diff line change @@ -431,7 +431,7 @@ object SymDenotations {
431
431
432
432
/** Does this symbol denote the primary constructor of its enclosing class? */
433
433
final def isPrimaryConstructor (implicit ctx : Context ) =
434
- isConstructor && owner.primaryConstructor == this
434
+ isConstructor && owner.primaryConstructor == symbol
435
435
436
436
/** Is this a subclass of the given class `base`? */
437
437
def isSubClass (base : Symbol )(implicit ctx : Context ) = false
@@ -1406,9 +1406,15 @@ object SymDenotations {
1406
1406
1407
1407
override def primaryConstructor (implicit ctx : Context ): Symbol = {
1408
1408
val cname = if (this is ImplClass ) nme.IMPLCLASS_CONSTRUCTOR else nme.CONSTRUCTOR
1409
- decls.denotsNamed(cname).first .symbol
1409
+ decls.denotsNamed(cname).last .symbol // denotsNamed returns Symbols in reverse order of occurrence
1410
1410
}
1411
1411
1412
+ /** The parameter accessors of this class. Term and type accessors,
1413
+ * getters and setters are all returned int his list
1414
+ */
1415
+ def paramAccessors (implicit ctx : Context ): List [Symbol ] =
1416
+ decls.filter(_ is ParamAccessor ).toList
1417
+
1412
1418
/** If this class has the same `decls` scope reference in `phase` and
1413
1419
* `phase.next`, install a new denotation with a cloned scope in `phase.next`.
1414
1420
*/
You can’t perform that action at this time.
0 commit comments