Skip to content

Commit d81ec1f

Browse files
committed
Remove retainsArg
1 parent dfdd8bf commit d81ec1f

File tree

6 files changed

+1
-18
lines changed

6 files changed

+1
-18
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ object Trees {
3434

3535
val SyntheticUnit: Property.StickyKey[Unit] = Property.StickyKey()
3636

37-
val CaptureVarDef: Property.StickyKey[Unit] = Property.StickyKey()
38-
3937
/** Trees take a parameter indicating what the type of their `tpe` field
4038
* is. Two choices: `Type` or `Untyped`.
4139
* Untyped trees have type `Tree[Untyped]`.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
536536
else
537537
val trefs =
538538
if refs.isEmpty then ref(defn.NothingType)
539+
// TODO: choose a reduce direction
539540
else refs.map(SingletonTypeTree).reduce[Tree]((a, b) => makeOrType(a, b))
540541
annot = New(AppliedTypeTree(annot, trefs :: Nil), Nil)
541542
annot.putAttachment(RetainsAnnot, ())

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,6 @@ class Definitions {
10931093
@tu lazy val RetainsAnnot: ClassSymbol = requiredClass("scala.annotation.retains")
10941094
@tu lazy val RetainsCapAnnot: ClassSymbol = requiredClass("scala.annotation.retainsCap")
10951095
@tu lazy val RetainsByNameAnnot: ClassSymbol = requiredClass("scala.annotation.retainsByName")
1096-
@tu lazy val RetainsArgAnnot: ClassSymbol = requiredClass("scala.annotation.retainsArg")
10971096
@tu lazy val PublicInBinaryAnnot: ClassSymbol = requiredClass("scala.annotation.publicInBinary")
10981097
@tu lazy val WitnessNamesAnnot: ClassSymbol = requiredClass("scala.annotation.internal.WitnessNames")
10991098

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4497,15 +4497,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
44974497
true
44984498
}
44994499

4500-
def isRetainsArg(pt: Type) = pt match
4501-
case AnnotatedType(arg, annot) => annot.symbol == defn.RetainsArgAnnot
4502-
case _ => false
4503-
45044500
if (implicitFun || caseCompanion)
45054501
&& !isApplyProto(pt)
45064502
&& pt != SingletonTypeProto
45074503
&& pt != LhsProto
4508-
&& !isRetainsArg(pt)
45094504
&& !ctx.mode.is(Mode.Pattern)
45104505
&& !tree.isInstanceOf[SplicePattern]
45114506
&& !ctx.isAfterTyper

library/src/scala/annotation/retains.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,3 @@ class retains[Elems] extends annotation.StaticAnnotation
2020
class retainsCap extends annotation.StaticAnnotation
2121
// This special case is needed to be able to load standard library modules without
2222
// cyclic reference errors. Specifically, load sequences involving IterableOnce.
23-
24-
/** Internal use, only for parameters of `retains` and `retainsByName`.
25-
*/
26-
@experimental
27-
class retainsArg extends annotation.StaticAnnotation
28-
// This annotation prevents argument references to retains and retainsByName from being
29-
// augmented with explicit arguments. That's unsound in general, but necessary
30-
// since a captureRef could have an impure context function type, A ?=> B, but
31-
// we still need to have the unapplied captureRef in the annotation.

tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ val experimentalDefinitionInLibrary = Set(
3030
"scala.annotation.retains",
3131
"scala.annotation.retainsByName",
3232
"scala.annotation.retainsCap",
33-
"scala.annotation.retainsArg",
3433
"scala.Pure",
3534
"scala.caps.CapSet",
3635
"scala.caps.Capability",

0 commit comments

Comments
 (0)