Skip to content

Commit 02533ed

Browse files
committed
Fix overloaded default methods test in RefChecks
It used `cls.info` instead of `cls.thisType`, which caused symbols accessible only through the self type of `cls` to be forgotten. Fixes #18555
1 parent 95a8a9c commit 02533ed

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ object RefChecks {
5252
}}
5353

5454
for (name <- defaultMethodNames) {
55-
val methods = clazz.info.member(name).alternatives.map(_.symbol)
55+
val methods = clazz.thisType.member(name).alternatives.map(_.symbol)
5656
val haveDefaults = methods.filter(_.hasDefaultParams)
5757
if (haveDefaults.length > 1) {
5858
val owners = haveDefaults map (_.owner)

tests/pos/i18555.scala

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
trait GenericCollectionWithCommands {
2+
self: PackSupport =>
3+
4+
def bar(foo: Int = 1): Any = ???
5+
def bar(writer: GenericCollectionWithCommands.this.pack.Writer[Any]): Any = ???
6+
}
7+
8+
trait PackSupport {
9+
val pack: SerializationPack
10+
}
11+
12+
trait SerializationPack {
13+
type Writer[A]
14+
}

0 commit comments

Comments
 (0)