Skip to content

Commit cdd844f

Browse files
Merge pull request #6487 from dotty-staging/change-explaining-printer
Add test for errors involving module classes
2 parents 494f9e6 + 4d8de4e commit cdd844f

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/neg/module-class-name.check

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[287..289..292] in module-class-name.scala
2+
value foo is not a member of object Test.C
3+
[247..248] in module-class-name.scala
4+
Found: object Test.C
5+
Required: Int
6+
[192..193] in module-class-name.scala
7+
Found: object Test.C
8+
Required: Test.C
9+
[127..128] in module-class-name.scala
10+
Found: Test.C.type
11+
Required: Test.C
12+
[74..75] in module-class-name.scala
13+
Found: Test.C.type
14+
Required: Test.C

tests/neg/module-class-name.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
object Test {
2+
class C
3+
object C
4+
5+
def f[T](x: T): T = x
6+
7+
val x: C = C // error: Found: Test.C.type
8+
9+
val y: C = f(C) // error: Found: Test.C.type
10+
11+
def z = f(C)
12+
val z1: C = z // error: Found: object Test.C
13+
val z2: Int = z // error: Found: object Test.C
14+
15+
C.foo // error: value foo is not a member of object Test.C
16+
}

0 commit comments

Comments
 (0)