Skip to content

Commit eedcb87

Browse files
committed
Change more tests and docs
1 parent 5b31ecc commit eedcb87

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

compiler/test/dotty/tools/backend/jvm/InlineBytecodeTests.scala

+8-8
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
7575

7676
@Test def i4947 = {
7777
val source = """class Foo {
78-
| inline def track[T](inline f: T) <: T = {
78+
| transparent inline def track[T](inline f: T): T = {
7979
| foo("tracking") // line 3
8080
| f // line 4
8181
| }
@@ -134,11 +134,11 @@ class InlineBytecodeTests extends DottyBytecodeTest {
134134

135135
@Test def i4947b = {
136136
val source = """class Foo {
137-
| inline def track2[T](inline f: T) <: T = {
137+
| transparent inline def track2[T](inline f: T): T = {
138138
| foo("tracking2") // line 3
139139
| f // line 4
140140
| }
141-
| inline def track[T](inline f: T) <: T = {
141+
| transparent inline def track[T](inline f: T): T = {
142142
| foo("tracking") // line 7
143143
| track2 { // line 8
144144
| f // line 9
@@ -194,11 +194,11 @@ class InlineBytecodeTests extends DottyBytecodeTest {
194194

195195
@Test def i4947c = {
196196
val source = """class Foo {
197-
| inline def track2[T](inline f: T) <: T = {
197+
| transparent inline def track2[T](inline f: T): T = {
198198
| foo("tracking2") // line 3
199199
| f // line 4
200200
| }
201-
| inline def track[T](inline f: T) <: T = {
201+
| transparent inline def track[T](inline f: T): T = {
202202
| track2 { // line 7
203203
| foo("fgh") // line 8
204204
| f // line 9
@@ -254,11 +254,11 @@ class InlineBytecodeTests extends DottyBytecodeTest {
254254

255255
@Test def i4947d = {
256256
val source = """class Foo {
257-
| inline def track2[T](inline f: T) <: T = {
257+
| transparent inline def track2[T](inline f: T): T = {
258258
| foo("tracking2") // line 3
259259
| f // line 4
260260
| }
261-
| inline def track[T](inline f: T) <: T = {
261+
| transparent inline def track[T](inline f: T): T = {
262262
| track2 { // line 7
263263
| track2 { // line 8
264264
| f // line 9
@@ -319,7 +319,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
319319
| def test: Int = {
320320
| var a = 10
321321
|
322-
| inline def f() = {
322+
| transparent inline def f() = {
323323
| a += 1
324324
| }
325325
|

docs/docs/reference/metaprogramming/macros.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ inline method that can calculate either a value of type `Int` or a value of type
601601
`String`.
602602

603603
```scala
604-
inline def defaultOf(inline str: String) <: Any = ${ defaultOfImpl('str) }
604+
transparent inline def defaultOf(inline str: String) = ${ defaultOfImpl('str) }
605605

606606
def defaultOfImpl(strExpr: Expr[String])(using QuoteContext): Expr[Any] =
607607
strExpr.unliftOrError match

tests/disabled/pos/quote-whitebox/Macro_1.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.quoted._
33

44
object Macro {
55

6-
inline def charOrString(inline str: String) <: Char | String = ${ impl(str) }
6+
transparent inline def charOrString(inline str: String): Char | String = ${ impl(str) }
77

88
def impl(str: String) = if (str.length == 1) Expr(str.charAt(0)) else Expr(str)
99

tests/invalid/run/typelevel-patmat.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object Test extends App {
2121
type HNil = HNil.type
2222
type Z = Z.type
2323

24-
inline def ToNat(inline n: Int) <: Typed[Nat] =
24+
transparent inline def ToNat(inline n: Int): Typed[Nat] =
2525
if n == 0 then Typed(Z)
2626
else Typed(S(ToNat(n - 1).value))
2727

@@ -35,7 +35,7 @@ object Test extends App {
3535
println(x1)
3636
println(x2)
3737

38-
inline def toInt(n: Nat) <: Int = inline n match {
38+
transparent inline def toInt(n: Nat): Int = inline n match {
3939
case Z => 0
4040
case S(n1) => toInt(n1) + 1
4141
}

0 commit comments

Comments
 (0)