Skip to content

Commit

Permalink
Test backquoted "leading infix" lookalike (#3624)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 7, 2024
1 parent e3ec1b2 commit c85ef20
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
Expand Up @@ -399,6 +399,30 @@ class DefnSuite extends ParseSuite {
runTestAssert[Stat](code, layout)(tree)
}

test("#3617 scala213") {
val codeWithoutBlank =
"""|object Test {
| def bar =
| `f-oo`
|}
|""".stripMargin
val codeWithBlank =
"""|object Test {
| def bar =
| `f-oo`
|
|}
|""".stripMargin
val layout = "object Test { def bar = `f-oo` }"
val tree = Defn.Object(
Nil,
tname("Test"),
tpl(Defn.Def(Nil, tname("bar"), Nil, None, tname("f-oo")))
)
runTestAssert[Stat](codeWithoutBlank, layout)(tree)
runTestAssert[Stat](codeWithBlank, layout)(tree)
}

test("#3571 scala213source3") {
implicit val Scala213 = scala.meta.dialects.Scala213Source3
val code =
Expand Down Expand Up @@ -440,4 +464,29 @@ class DefnSuite extends ParseSuite {
runTestAssert[Stat](code, layout)(tree)
}

test("#3617 scala213source3") {
implicit val Scala213 = scala.meta.dialects.Scala213Source3
val codeWithoutBlank =
"""|object Test {
| def bar =
| `f-oo`
|}
|""".stripMargin
val codeWithBlank =
"""|object Test {
| def bar =
| `f-oo`
|
|}
|""".stripMargin
val layout = "object Test { def bar = `f-oo` }"
val tree = Defn.Object(
Nil,
tname("Test"),
tpl(Defn.Def(Nil, tname("bar"), Nil, None, tname("f-oo")))
)
runTestAssert[Stat](codeWithoutBlank, layout)(tree)
runTestAssert[Stat](codeWithBlank, layout)(tree)
}

}
Expand Up @@ -3381,4 +3381,28 @@ class SignificantIndentationSuite extends BaseDottySuite {
runTestAssert[Stat](code, layout)(tree)
}

test("#3617 scala3") {
val codeWithoutBlank =
"""|object Test {
| def bar =
| `f-oo`
|}
|""".stripMargin
val codeWithBlank =
"""|object Test {
| def bar =
| `f-oo`
|
|}
|""".stripMargin
val layout = "object Test { def bar = `f-oo` }"
val tree = Defn.Object(
Nil,
tname("Test"),
tpl(Defn.Def(Nil, tname("bar"), Nil, None, tname("f-oo")))
)
runTestAssert[Stat](codeWithoutBlank, layout)(tree)
runTestAssert[Stat](codeWithBlank, layout)(tree)
}

}

0 comments on commit c85ef20

Please sign in to comment.