-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #10122: check parent types of references and types of parameters
- Loading branch information
1 parent
9ec34f8
commit c24a20a
Showing
2 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import scala.annotation.compileTimeOnly | ||
|
||
@compileTimeOnly("FooBar can not be used as an expression") trait FooBar | ||
|
||
object foo extends FooBar // error | ||
|
||
val fooAnon = new FooBar {} // error // error | ||
val fooRef1: FooBar = ??? // error | ||
def fooRef2: FooBar = ??? // error | ||
def useFoo(foo: FooBar): foo.type = foo // error // error // error | ||
val bar = fooRef2 // error | ||
|
||
@compileTimeOnly("baz can not be used as an expression") val baz = 23 | ||
val qux = baz // error | ||
|
||
@compileTimeOnly("quux can not be used as an expression") def quux = 47 | ||
val quxx = quux // error |