Skip to content

Commit d19d555

Browse files
Allow overriding artifacts when generating bridges
1 parent d31d775 commit d19d555

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ object SymDenotations {
11411141
* either as overrider or overridee.
11421142
*/
11431143
final def memberCanMatchInheritedSymbols(implicit ctx: Context): Boolean =
1144-
!isConstructor && !is(Private | Artifact)
1144+
!isConstructor && !is(Private)
11451145

11461146
/** The symbol, in class `inClass`, that is overridden by this denotation in class `siteClass`.*/
11471147
final def overriddenSymbol(inClass: ClassSymbol, siteClass: ClassSymbol = owner.asClass)(implicit ctx: Context): Symbol =

compiler/src/dotty/tools/dotc/transform/Bridges.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Bridges(root: ClassSymbol, thisPhase: DenotTransformer)(implicit ctx: Cont
1919
private val preErasureCtx = ctx.withPhase(ctx.erasurePhase)
2020
private val elimErasedCtx = ctx.withPhase(ctx.elimErasedValueTypePhase.next)
2121

22-
private class BridgesCursor(implicit ctx: Context) extends OverridingPairs.Cursor(root) {
22+
private class BridgesCursor(implicit ctx: Context) extends OverridingPairs.Cursor(root, excludeArtifacts = false) {
2323

2424
/** Only use the superclass of `root` as a parent class. This means
2525
* overriding pairs that have a common implementation in a trait parent

compiler/src/dotty/tools/dotc/transform/OverridingPairs.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ object OverridingPairs {
2020
/** The cursor class
2121
* @param base the base class that contains the overriding pairs
2222
*/
23-
class Cursor(base: Symbol)(implicit ctx: Context) {
23+
class Cursor(base: Symbol, excludeArtifacts: Boolean = true)(implicit ctx: Context) {
2424

2525
private val self = base.thisType
2626

2727
/** Symbols to exclude: Here these are constructors and private locals.
2828
* But it may be refined in subclasses.
2929
*/
30-
protected def exclude(sym: Symbol): Boolean = !sym.memberCanMatchInheritedSymbols
30+
protected def exclude(sym: Symbol): Boolean =
31+
!sym.memberCanMatchInheritedSymbols || (excludeArtifacts && sym.is(Artifact))
3132

3233
/** The parents of base that are checked when deciding whether an overriding
3334
* pair has already been treated in a parent class.

0 commit comments

Comments
 (0)