File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
src/reflect/scala/reflect/internal Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -1017,7 +1017,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
1017
1017
1018
1018
/** Is this symbol effectively final? I.e, it cannot be overridden */
1019
1019
final def isEffectivelyFinal : Boolean = (
1020
- (this hasFlag FINAL | PACKAGE )
1020
+ (( this hasFlag FINAL | PACKAGE ) && this != SingletonClass )
1021
1021
|| isModuleOrModuleClass && (isTopLevel || ! settings.overrideObjects)
1022
1022
|| isTerm && (isPrivate || isLocalToBlock || (hasAllFlags(notPRIVATE | METHOD ) && ! hasFlag(DEFERRED )))
1023
1023
|| isClass && originalOwner.isTerm && children.isEmpty // we track known subclasses of term-owned classes, use that infer finality
Original file line number Diff line number Diff line change @@ -4133,12 +4133,13 @@ trait Types
4133
4133
throw new MatchError ((tp1, tp2))
4134
4134
}
4135
4135
4136
- def check (tp1 : Type , tp2 : Type ) = (
4137
- if (tp1.typeSymbol.isClass && tp1.typeSymbol.hasFlag(FINAL ))
4138
- tp1 <:< tp2 || isNumericValueClass(tp1.typeSymbol) && isNumericValueClass(tp2.typeSymbol)
4136
+ def check (tp1 : Type , tp2 : Type ) = {
4137
+ val sym1 = tp1.typeSymbol
4138
+ if (sym1.isClass && sym1.hasFlag(FINAL ) && sym1 != SingletonClass )
4139
+ tp1 <:< tp2 || isNumericValueClass(sym1) && isNumericValueClass(tp2.typeSymbol)
4139
4140
else tp1.baseClasses forall (bc =>
4140
4141
tp2.baseTypeIndex(bc) < 0 || isConsistent(tp1.baseType(bc), tp2.baseType(bc)))
4141
- )
4142
+ }
4142
4143
4143
4144
check(tp1, tp2) && check(tp2, tp1)
4144
4145
}
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ object Foo
3
+ Tuple1 [Foo .type ](Foo ) match {
4
+ case Tuple1 (foo : Singleton ) => foo
5
+ }
6
+ }
You can’t perform that action at this time.
0 commit comments