Skip to content

Commit 2548798

Browse files
committed
Use transparent inline in the library
And add deprecation warnings for old syntax
1 parent b3f2aee commit 2548798

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3278,6 +3278,7 @@ object Parsers {
32783278
leadingVparamss ::: rparamss
32793279
var tpt = fromWithinReturnType {
32803280
if in.token == SUBTYPE && mods.is(Inline) && AllowOldWhiteboxSyntax then
3281+
deprecationWarning("`<:` return type will no longer be suported. Use transparent modifier insead.")
32813282
in.nextToken()
32823283
mods1 = addMod(mods1, Mod.Transparent())
32833284
toplevelTyp()
@@ -3547,6 +3548,7 @@ object Parsers {
35473548
mods1 |= Final
35483549
DefDef(name, tparams, vparamss, tpt, subExpr())
35493550
if in.token == USCORE && AllowOldWhiteboxSyntax then
3551+
deprecationWarning("`<:` return type will no longer be suported. Use transparent modifier insead.")
35503552
if !mods.is(Inline) then
35513553
syntaxError("`_ <:` is only allowed for given with `inline` modifier")
35523554
in.nextToken()

library/src/dotty/DottyPredef.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object DottyPredef {
88
assertFail(message)
99
}
1010

11-
inline final def assert(inline assertion: Boolean) <: Unit = {
11+
transparent inline final def assert(inline assertion: Boolean): Unit = {
1212
if (!assertion)
1313
assertFail()
1414
}

library/src/scala/compiletime/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ package object compiletime {
5252
*
5353
* the returned value would be `2`.
5454
*/
55-
inline def summonFrom[T](f: Nothing => T) <: T = ???
55+
transparent inline def summonFrom[T](f: Nothing => T): T = ???
5656

5757

5858
/** Summon a given value of type `T`. Usually, the argument is not passed explicitly.
@@ -61,7 +61,7 @@ package object compiletime {
6161
* @tparam T the type of the value to be summoned
6262
* @return the given value typed as the provided type parameter
6363
*/
64-
inline def summonInline[T] <: T = summonFrom {
64+
transparent inline def summonInline[T]: T = summonFrom {
6565
case t: T => t
6666
}
6767

0 commit comments

Comments
 (0)