Skip to content

Commit 06929b1

Browse files
committed
Rename transparent -> inline
1 parent 706f5ef commit 06929b1

File tree

84 files changed

+189
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+189
-226
lines changed

bench/tests/power-macro/PowerMacro.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted.Expr
22

33
object PowerMacro {
44

5-
inline def power(transparent n: Long, x: Double) = ~powerCode(n, '(x))
5+
inline def power(inline n: Long, x: Double) = ~powerCode(n, '(x))
66

77
def powerCode(n: Long, x: Expr[Double]): Expr[Double] =
88
if (n == 0) '(1.0)

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,11 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
464464
* Strictly speaking we can't replace `O.x` with `42`. But this would make
465465
* most expressions non-constant. Maybe we can change the spec to accept this
466466
* kind of eliding behavior. Or else enforce true purity in the compiler.
467-
* The choice will be affected by what we will do with `transparent` and with
467+
* The choice will be affected by what we will do with `inline` and with
468468
* Singleton type bounds (see SIP 23). Presumably
469469
*
470470
* object O1 { val x: Singleton = 42; println("43") }
471-
* object O2 { transparent val x = 42; println("43") }
471+
* object O2 { inline val x = 42; println("43") }
472472
*
473473
* should behave differently.
474474
*
@@ -478,8 +478,8 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
478478
*
479479
* O2.x = 42
480480
*
481-
* Revisit this issue once we have standardized on `transparent`. Then we can demand
482-
* purity of the prefix unless the selection goes to a transparent val.
481+
* Revisit this issue once we have standardized on `inline`. Then we can demand
482+
* purity of the prefix unless the selection goes to a inline val.
483483
*
484484
* Note: This method should be applied to all term tree nodes that are not literals,
485485
* that can be idempotent, and that can have constant types. So far, only nodes

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
134134

135135
case class Inline() extends Mod(Flags.Inline)
136136

137-
case class Transparent() extends Mod(Flags.Transparent)
138-
139137
case class Enum() extends Mod(Flags.Enum)
140138
}
141139

compiler/src/dotty/tools/dotc/core/Annotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ object Annotations {
5757
}
5858

5959
/** An annotation indicating the body of a right-hand side,
60-
* typically of an inline or transparent method. Treated specially in
60+
* typically of an inline method. Treated specially in
6161
* pickling/unpickling and TypeTreeMaps
6262
*/
6363
abstract class BodyAnnotation extends Annotation {

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,8 @@ class Definitions {
760760
def ImplicitNotFoundAnnot(implicit ctx: Context) = ImplicitNotFoundAnnotType.symbol.asClass
761761
lazy val ForceInlineAnnotType = ctx.requiredClassRef("scala.forceInline")
762762
def ForceInlineAnnot(implicit ctx: Context) = ForceInlineAnnotType.symbol.asClass
763-
lazy val TransparentParamAnnotType = ctx.requiredClassRef("scala.annotation.internal.TransparentParam")
764-
def TransparentParamAnnot(implicit ctx: Context) = TransparentParamAnnotType.symbol.asClass
763+
lazy val InlineParamAnnotType = ctx.requiredClassRef("scala.annotation.internal.InlineParam")
764+
def InlineParamAnnot(implicit ctx: Context) = InlineParamAnnotType.symbol.asClass
765765
lazy val InvariantBetweenAnnotType = ctx.requiredClassRef("scala.annotation.internal.InvariantBetween")
766766
def InvariantBetweenAnnot(implicit ctx: Context) = InvariantBetweenAnnotType.symbol.asClass
767767
lazy val MigrationAnnotType = ctx.requiredClassRef("scala.annotation.migration")

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,6 @@ object Flags {
329329
/** A method that has default params */
330330
final val DefaultParameterized = termFlag(27, "<defaultparam>")
331331

332-
/** Labelled with `transparent` modifier */
333-
final val Transparent = commonFlag(29, "transparent")
334-
335332
/** Symbol is defined by a Java class */
336333
final val JavaDefined = commonFlag(30, "<java>")
337334

@@ -436,7 +433,7 @@ object Flags {
436433

437434
/** Flags representing source modifiers */
438435
final val SourceModifierFlags =
439-
commonFlags(Private, Protected, Abstract, Final, Inline | Transparent,
436+
commonFlags(Private, Protected, Abstract, Final, Inline,
440437
Sealed, Case, Implicit, Override, AbsOverride, Lazy, JavaStatic, Erased)
441438

442439
/** Flags representing modifiers that can appear in trees */
@@ -457,7 +454,7 @@ object Flags {
457454
Scala2ExistentialCommon | Mutable.toCommonFlags | Touched | JavaStatic |
458455
CovariantOrOuter | ContravariantOrLabel | CaseAccessor.toCommonFlags |
459456
NonMember | ImplicitCommon | Permanent | Synthetic |
460-
SuperAccessorOrScala2x | Inline | Transparent
457+
SuperAccessorOrScala2x | Inline
461458

462459
/** Flags that are not (re)set when completing the denotation, or, if symbol is
463460
* a top-level class or object, when completing the denotation once the class
@@ -551,26 +548,23 @@ object Flags {
551548
/** Assumed to be pure */
552549
final val StableOrErased = Stable | Erased
553550

554-
/** Labeled `private`, `final`, `inline` or `transparent` */
555-
final val EffectivelyFinal = Private | Final | Inline | Transparent
551+
/** Labeled `private`, `final`, or `inline` */
552+
final val EffectivelyFinal = Private | Final | Inline
556553

557554
/** A private method */
558555
final val PrivateMethod = allOf(Private, Method)
559556

560557
/** A private accessor */
561558
final val PrivateAccessor = allOf(Private, Accessor)
562559

563-
/** A transparent method */
564-
final val TransparentMethod = allOf(Transparent, Method)
565-
566560
/** An inline method */
567561
final val InlineMethod = allOf(Inline, Method)
568562

569563
/** An implicit inline method */
570564
final val ImplicitInlineMethod = allOf(Inline, Implicit, Method)
571565

572-
/** A transparent parameter */
573-
final val TransparentParam = allOf(Transparent, Param)
566+
/** An inline parameter */
567+
final val InlineParam = allOf(Inline, Param)
574568

575569
/** An enum case */
576570
final val EnumCase = allOf(Enum, Case)
@@ -596,8 +590,8 @@ object Flags {
596590
/** A deferred type member or parameter (these don't have right hand sides) */
597591
final val DeferredOrTypeParam = Deferred | TypeParam
598592

599-
/** value that's final or transparent */
600-
final val FinalOrTransparent = Final | Transparent
593+
/** value that's final or inline */
594+
final val FinalOrInline = Final | Inline
601595

602596
/** A covariant type parameter instance */
603597
final val LocalCovariant = allOf(Local, Covariant)

compiler/src/dotty/tools/dotc/core/Mode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ object Mode {
9595
/** We are in the IDE */
9696
val Interactive = newMode(20, "Interactive")
9797

98-
/** We are typing the body of a transparent or inline method */
98+
/** We are typing the body of an inline method */
9999
val InlineableBody = newMode(21, "InlineableBody")
100100

101101
/** Read comments from definitions when unpickling from TASTY */

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -779,16 +779,9 @@ object SymDenotations {
779779

780780
def isSkolem: Boolean = name == nme.SKOLEM
781781

782-
def isTransparentMethod(implicit ctx: Context): Boolean =
783-
is(TransparentMethod, butNot = AccessorOrSynthetic)
784-
785782
def isInlineMethod(implicit ctx: Context): Boolean =
786783
is(InlineMethod, butNot = AccessorOrSynthetic)
787784

788-
/** A transparent or inline method */
789-
def isInlineable(implicit ctx: Context): Boolean =
790-
is(TransparentMethod) || is(InlineMethod)
791-
792785
/** An erased value or an inline method, excluding @forceInline annotated methods.
793786
* The latter have to be kept around to get to parity with Scala.
794787
* This is necessary at least until we have full bootstrap. Right now

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,18 +3031,18 @@ object Types {
30313031
abstract class MethodTypeCompanion extends TermLambdaCompanion[MethodType] { self =>
30323032

30333033
/** Produce method type from parameter symbols, with special mappings for repeated
3034-
* and transparent parameters:
3034+
* and inline parameters:
30353035
* - replace @repeated annotations on Seq or Array types by <repeated> types
3036-
* - add @inlineParam to transparent call-by-value parameters
3036+
* - add @inlineParam to inline call-by-value parameters
30373037
*/
30383038
def fromSymbols(params: List[Symbol], resultType: Type)(implicit ctx: Context) = {
3039-
def translateTransparent(tp: Type): Type = tp match {
3039+
def translateInline(tp: Type): Type = tp match {
30403040
case _: ExprType => tp
3041-
case _ => AnnotatedType(tp, Annotation(defn.TransparentParamAnnot))
3041+
case _ => AnnotatedType(tp, Annotation(defn.InlineParamAnnot))
30423042
}
30433043
def paramInfo(param: Symbol) = {
30443044
val paramType = param.info.annotatedToRepeated
3045-
if (param.is(Transparent)) translateTransparent(paramType) else paramType
3045+
if (param.is(Inline)) translateInline(paramType) else paramType
30463046
}
30473047

30483048
apply(params.map(_.name.asTermName))(

compiler/src/dotty/tools/dotc/core/tasty/TastyFormat.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ Standard-Section: "ASTs" TopLevelStat*
183183
ERASED
184184
LAZY
185185
OVERRIDE
186-
TRANSPARENT
187186
INLINE
188187
MACRO // inline method containing toplevel splices
189188
STATIC // mapped to static Java member
@@ -299,7 +298,7 @@ object TastyFormat {
299298
final val IMPLICIT = 13
300299
final val LAZY = 14
301300
final val OVERRIDE = 15
302-
final val TRANSPARENT = 16
301+
303302
final val INLINE = 17
304303
final val STATIC = 18
305304
final val OBJECT = 19
@@ -481,7 +480,6 @@ object TastyFormat {
481480
| ERASED
482481
| LAZY
483482
| OVERRIDE
484-
| TRANSPARENT
485483
| INLINE
486484
| MACRO
487485
| STATIC
@@ -539,7 +537,6 @@ object TastyFormat {
539537
case ERASED => "ERASED"
540538
case LAZY => "LAZY"
541539
case OVERRIDE => "OVERRIDE"
542-
case TRANSPARENT => "TRANSPARENT"
543540
case INLINE => "INLINE"
544541
case MACRO => "MACRO"
545542
case STATIC => "STATIC"

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ class TreePickler(pickler: TastyPickler) {
616616
if (flags.is(Final, butNot = Module)) writeByte(FINAL)
617617
if (flags is Case) writeByte(CASE)
618618
if (flags is Override) writeByte(OVERRIDE)
619-
if (flags is Transparent) writeByte(TRANSPARENT)
620619
if (flags is Inline) writeByte(INLINE)
621620
if (flags is Macro) writeByte(MACRO)
622621
if (flags is JavaStatic) writeByte(STATIC)

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,6 @@ class TreeUnpickler(reader: TastyReader,
591591
case ERASED => addFlag(Erased)
592592
case LAZY => addFlag(Lazy)
593593
case OVERRIDE => addFlag(Override)
594-
case TRANSPARENT => addFlag(Transparent)
595594
case INLINE => addFlag(Inline)
596595
case MACRO => addFlag(Macro)
597596
case STATIC => addFlag(JavaStatic)

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,6 @@ object Parsers {
17781778
case FINAL => Mod.Final()
17791779
case IMPLICIT => Mod.Implicit()
17801780
case ERASED => Mod.Erased()
1781-
case TRANSPARENT => Mod.Transparent()
17821781
case LAZY => Mod.Lazy()
17831782
case OVERRIDE => Mod.Override()
17841783
case PRIVATE => Mod.Private()
@@ -1988,15 +1987,15 @@ object Parsers {
19881987
addMod(mods, mod)
19891988
}
19901989
else {
1991-
if (!(mods.flags &~ (ParamAccessor | Transparent)).isEmpty)
1990+
if (!(mods.flags &~ (ParamAccessor | Inline)).isEmpty)
19921991
syntaxError("`val' or `var' expected")
19931992
if (firstClauseOfCaseClass) mods
19941993
else mods | PrivateLocal
19951994
}
19961995
}
19971996
}
19981997
else {
1999-
if (in.token == TRANSPARENT) mods = addModifier(mods)
1998+
if (isIdent(nme.INLINEkw)) mods = addModifier(mods)
20001999
mods = atPos(start) { mods | Param }
20012000
}
20022001
atPos(start, nameStart) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ object Scanners {
200200
private def handleMigration(keyword: Token): Token =
201201
if (!isScala2Mode) keyword
202202
else if ( keyword == ENUM
203-
|| keyword == ERASED
204-
|| keyword == TRANSPARENT) treatAsIdent()
203+
|| keyword == ERASED) treatAsIdent()
205204
else keyword
206205

207206

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ abstract class TokensCommon {
9191
//final val LAZY = 59; enter(LAZY, "lazy")
9292
//final val THEN = 60; enter(THEN, "then")
9393
//final val FORSOME = 61; enter(FORSOME, "forSome") // TODO: deprecate
94-
//final val TRANSPARENT = 63; enter(TRANSPARENT, "transparent")
95-
//final val ENUM = 64; enter(ENUM, "enum")
96-
//final val ERASED = 65; enter(ERASED, "erased")
94+
//final val ENUM = 62; enter(ENUM, "enum")
95+
//final val ERASED = 63; enter(ERASED, "erased")
9796

9897
/** special symbols */
9998
final val COMMA = 70; enter(COMMA, "','")
@@ -176,9 +175,8 @@ object Tokens extends TokensCommon {
176175
final val LAZY = 59; enter(LAZY, "lazy")
177176
final val THEN = 60; enter(THEN, "then")
178177
final val FORSOME = 61; enter(FORSOME, "forSome") // TODO: deprecate
179-
final val TRANSPARENT = 63; enter(TRANSPARENT, "transparent")
180-
final val ENUM = 64; enter(ENUM, "enum")
181-
final val ERASED = 65; enter(ERASED, "erased")
178+
final val ENUM = 62; enter(ENUM, "enum")
179+
final val ERASED = 63; enter(ERASED, "erased")
182180

183181
/** special symbols */
184182
final val NEWLINE = 78; enter(NEWLINE, "end of statement", "new line")
@@ -227,7 +225,7 @@ object Tokens extends TokensCommon {
227225
final val defIntroTokens = templateIntroTokens | dclIntroTokens
228226

229227
final val localModifierTokens = BitSet(
230-
ABSTRACT, FINAL, SEALED, IMPLICIT, TRANSPARENT, LAZY, ERASED)
228+
ABSTRACT, FINAL, SEALED, IMPLICIT, LAZY, ERASED)
231229

232230
final val accessModifierTokens = BitSet(
233231
PRIVATE, PROTECTED)

compiler/src/dotty/tools/dotc/reporting/diagnostic/ErrorMessageID.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public enum ErrorMessageID {
125125
UnableToEmitSwitchID,
126126
MissingCompanionForStaticID,
127127
PolymorphicMethodMissingTypeInParentID,
128-
ParamsNoTransparentID,
128+
ParamsNoInlineID,
129129
JavaSymbolIsNotAValueID,
130130
DoubleDeclarationID,
131131
MatchCaseOnlyNullWarningID,

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ object messages {
17361736
val kind = "Syntax"
17371737
val msg = hl"no explicit ${"return"} allowed from inlineable $owner"
17381738
val explanation =
1739-
hl"""Methods marked with ${"inline"} or ${"transparent"} modifier may not use ${"return"} statements.
1739+
hl"""Methods marked with ${"inline"} modifier may not use ${"return"} statements.
17401740
|Instead, you should rely on the last expression's value being
17411741
|returned from a method.
17421742
|"""
@@ -2042,10 +2042,10 @@ object messages {
20422042
|polymorphic methods."""
20432043
}
20442044

2045-
case class ParamsNoTransparent(owner: Symbol)(implicit ctx: Context)
2046-
extends Message(ParamsNoTransparentID) {
2045+
case class ParamsNoInline(owner: Symbol)(implicit ctx: Context)
2046+
extends Message(ParamsNoInlineID) {
20472047
val kind = "Syntax"
2048-
val msg = hl"""${"transparent"} modifier can only be used for parameters of inline methods"""
2048+
val msg = hl"""${"inline"} modifier can only be used for parameters of inline methods"""
20492049
val explanation = ""
20502050
}
20512051

compiler/src/dotty/tools/dotc/tastyreflect/FlagSet.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class FlagSet(flags: Flags.FlagSet) extends scala.tasty.reflect.FlagSet {
1414
def isErased: Boolean = flags.is(Erased)
1515
def isLazy: Boolean = flags.is(Lazy)
1616
def isOverride: Boolean = flags.is(Override)
17-
def isTransparent: Boolean = flags.is(Transparent)
1817
def isInline: Boolean = flags.is(Inline)
1918
def isMacro: Boolean = flags.is(Macro)
2019
def isStatic: Boolean = flags.is(JavaStatic)
@@ -46,7 +45,6 @@ class FlagSet(flags: Flags.FlagSet) extends scala.tasty.reflect.FlagSet {
4645
if (isErased) flags += "erased"
4746
if (isLazy) flags += "lazy"
4847
if (isOverride) flags += "override"
49-
if (isTransparent) flags += "transparent"
5048
if (isInline) flags += "inline"
5149
if (isMacro) flags += "macro"
5250
if (isStatic) flags += "javaStatic"

compiler/src/dotty/tools/dotc/transform/ExtensionMethods.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Decorators._
2121
import SymUtils._
2222

2323
/**
24-
* Perform Step 1 in the transparent classes SIP: Creates extension methods for all
24+
* Perform Step 1 in the inline classes SIP: Creates extension methods for all
2525
* methods in a value class, except parameter or super accessors, or constructors.
2626
*
2727
* Additionally, for a value class V, let U be the underlying type after erasure. We add

compiler/src/dotty/tools/dotc/transform/Literalize.scala.disabled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Literalize extends MiniPhase { thisTransform =>
3838
* Singleton type bounds (see SIP 23). Presumably
3939
*
4040
* object O1 { val x: Singleton = 42; println("43") }
41-
* object O2 { transparent val x = 42; println("43") }
41+
* object O2 { inline val x = 42; println("43") }
4242
*
4343
* should behave differently.
4444
*

compiler/src/dotty/tools/dotc/transform/Memoize.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class Memoize extends MiniPhase with IdentityDenotTransformer { thisPhase =>
105105
cpy.installAfter(thisPhase)
106106
}
107107

108-
val NoFieldNeeded = Lazy | Deferred | JavaDefined | (if (ctx.settings.YnoInline.value) EmptyFlags else Transparent)
108+
val NoFieldNeeded = Lazy | Deferred | JavaDefined | (if (ctx.settings.YnoInline.value) EmptyFlags else Inline)
109109

110110
def erasedBottomTree(sym: Symbol) = {
111111
if (sym eq defn.NothingClass) Throw(Literal(Constant(null)))

0 commit comments

Comments
 (0)