File tree Expand file tree Collapse file tree 2 files changed +39
-5
lines changed
src/reflect/scala/reflect/internal Expand file tree Collapse file tree 2 files changed +39
-5
lines changed Original file line number Diff line number Diff line change @@ -3392,11 +3392,14 @@ trait Types
3392
3392
/** Rebind symbol `sym` to an overriding member in type `pre`. */
3393
3393
private def rebind (pre : Type , sym : Symbol ): Symbol = {
3394
3394
if (! sym.isOverridableMember || sym.owner == pre.typeSymbol) sym
3395
- else pre.nonPrivateMember(sym.name).suchThat(sym =>
3396
- // SI-7928 `isModuleNotMethod` is here to avoid crashing with overloaded module accessor and module symbols
3397
- // after refchecks eliminates a ModuleDef that implements and interface.
3398
- sym.isType || (! sym.isModuleNotMethod && sym.isStable && ! sym.hasVolatileType)
3399
- ) orElse sym
3395
+ else pre.nonPrivateMember(sym.name).suchThat { sym =>
3396
+ // SI-7928 `isModuleNotMethod` is here to avoid crashing with spuriously "overloaded" module accessor and module symbols.
3397
+ // These appear after refchecks eliminates ModuleDefs that implement an interface.
3398
+ // Here, we exclude the module symbol, which allows us to bind to the accessor.
3399
+ // SI-8054 We must only do this after refchecks, otherwise we exclude the module symbol which does not yet have an accessor!
3400
+ val isModuleWithAccessor = phase.refChecked && sym.isModuleNotMethod
3401
+ sym.isType || (! isModuleWithAccessor && sym.isStable && ! sym.hasVolatileType)
3402
+ } orElse sym
3400
3403
}
3401
3404
3402
3405
/** Convert a `super` prefix to a this-type if `sym` is abstract or final. */
Original file line number Diff line number Diff line change
1
+ trait D {
2
+ trait Manifest {
3
+ class Entry
4
+ }
5
+
6
+ val M : Manifest
7
+
8
+ def m : M .Entry = ???
9
+ }
10
+
11
+ object D1 extends D {
12
+ object M extends Manifest
13
+ }
14
+
15
+ object D2 extends D {
16
+ val M : Manifest = ???
17
+ }
18
+
19
+ object Hello {
20
+
21
+ def main (args : Array [String ]) {
22
+ // 2.10.3 - ok
23
+ // 2.11.0-M7 - type mismatch; found : Seq[DB1.MANIFEST.Entry]
24
+ // required: Seq[DB1.MANIFEST.Entry]
25
+ val t1 : D1 .M .Entry = D1 .m
26
+
27
+ // 2.10.3 - ok
28
+ // 2.11.0-M7 - ok
29
+ val t2 : D2 .M .Entry = D2 .m
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments