Skip to content

Add test for errors involving module classes #6487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/neg/module-class-name.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[287..289..292] in module-class-name.scala
value foo is not a member of object Test.C
[247..248] in module-class-name.scala
Found: object Test.C
Required: Int
[192..193] in module-class-name.scala
Found: object Test.C
Required: Test.C
[127..128] in module-class-name.scala
Found: Test.C.type
Required: Test.C
[74..75] in module-class-name.scala
Found: Test.C.type
Required: Test.C
16 changes: 16 additions & 0 deletions tests/neg/module-class-name.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
object Test {
class C
object C

def f[T](x: T): T = x

val x: C = C // error: Found: Test.C.type

val y: C = f(C) // error: Found: Test.C.type

def z = f(C)
val z1: C = z // error: Found: object Test.C
val z2: Int = z // error: Found: object Test.C

C.foo // error: value foo is not a member of object Test.C
}