Skip to content
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

Fix-17242 #17251

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions tests/neg/cycles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class E {
lazy val x: F#T = ???
}

object CyclicAnnotation {
class local(num: Int) extends annotation.StaticAnnotation
def f(x: Int @local(x ++ x)) = ??? // error: Cyclic reference involving val x
}

class T1 {
type X = (U, U) // error: cycle
type U = X & Int
Expand Down
2 changes: 2 additions & 0 deletions tests/neg/singletons.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ object Test {
val sym: 'sym = 'sym // error: an identifier expected, but quoted identifier found

val foo: s"abc" = "abc" // error: not a legal singleton type

def path(x: String, z: x.length.type) = ??? // error: Int is not a valid singleton type, since it is not an immutable path
}
11 changes: 11 additions & 0 deletions tests/pos/i17242.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

class local(num: Int) extends annotation.StaticAnnotation
class local2(predicate: Boolean) extends annotation.StaticAnnotation

def working1(x: Int)(z: Int @local(x + x)) = ???
def working2(x: Int, z: Int @local(x)) = ???
def working3(x: Int, z: Int & x.type ) = ???


def failing1(x: Int, z: Int @local(x + x)) = ??? //error: undefined: x.+ # -1: TermRef(TermParamRef(x),+) at typer
def failing2(x: Int, z: Int @local2(x == x)) = ??? //error: undefined: x.== # -1: TermRef(TermParamRef(x),==) at typer