Skip to content

Commit e593e85

Browse files
Merge pull request #10492 from dotty-staging/add-refelction-docs
Add some docs to Reflection
2 parents 62b8b8e + 886fff0 commit e593e85

File tree

2 files changed

+846
-95
lines changed

2 files changed

+846
-95
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

+14-14
Original file line numberDiff line numberDiff line change
@@ -2062,82 +2062,82 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
20622062

20632063
object Constant extends ConstantModule:
20642064

2065-
object Boolean extends ConstantBooleanModule:
2065+
object Boolean extends BooleanModule:
20662066
def apply(x: Boolean): Constant = dotc.core.Constants.Constant(x)
20672067
def unapply(constant: Constant): Option[Boolean] =
20682068
if constant.tag == dotc.core.Constants.BooleanTag then Some(constant.booleanValue)
20692069
else None
20702070
end Boolean
20712071

2072-
object Byte extends ConstantByteModule:
2072+
object Byte extends ByteModule:
20732073
def apply(x: Byte): Constant = dotc.core.Constants.Constant(x)
20742074
def unapply(constant: Constant): Option[Byte] =
20752075
if constant.tag == dotc.core.Constants.ByteTag then Some(constant.byteValue)
20762076
else None
20772077
end Byte
20782078

2079-
object Short extends ConstantShortModule:
2079+
object Short extends ShortModule:
20802080
def apply(x: Short): Constant = dotc.core.Constants.Constant(x)
20812081
def unapply(constant: Constant): Option[Short] =
20822082
if constant.tag == dotc.core.Constants.ShortTag then Some(constant.shortValue)
20832083
else None
20842084
end Short
20852085

2086-
object Int extends ConstantIntModule:
2086+
object Int extends IntModule:
20872087
def apply(x: Int): Constant = dotc.core.Constants.Constant(x)
20882088
def unapply(constant: Constant): Option[Int] =
20892089
if constant.tag == dotc.core.Constants.IntTag then Some(constant.intValue)
20902090
else None
20912091
end Int
20922092

2093-
object Long extends ConstantLongModule:
2093+
object Long extends LongModule:
20942094
def apply(x: Long): Constant = dotc.core.Constants.Constant(x)
20952095
def unapply(constant: Constant): Option[Long] =
20962096
if constant.tag == dotc.core.Constants.LongTag then Some(constant.longValue)
20972097
else None
20982098
end Long
20992099

2100-
object Float extends ConstantFloatModule:
2100+
object Float extends FloatModule:
21012101
def apply(x: Float): Constant = dotc.core.Constants.Constant(x)
21022102
def unapply(constant: Constant): Option[Float] =
21032103
if constant.tag == dotc.core.Constants.FloatTag then Some(constant.floatValue)
21042104
else None
21052105
end Float
21062106

2107-
object Double extends ConstantDoubleModule:
2107+
object Double extends DoubleModule:
21082108
def apply(x: Double): Constant = dotc.core.Constants.Constant(x)
21092109
def unapply(constant: Constant): Option[Double] =
21102110
if constant.tag == dotc.core.Constants.DoubleTag then Some(constant.doubleValue)
21112111
else None
21122112
end Double
21132113

2114-
object Char extends ConstantCharModule:
2114+
object Char extends CharModule:
21152115
def apply(x: Char): Constant = dotc.core.Constants.Constant(x)
21162116
def unapply(constant: Constant): Option[Char] =
21172117
if constant.tag == dotc.core.Constants.CharTag then Some(constant.charValue)
21182118
else None
21192119
end Char
21202120

2121-
object String extends ConstantStringModule:
2121+
object String extends StringModule:
21222122
def apply(x: String): Constant = dotc.core.Constants.Constant(x)
21232123
def unapply(constant: Constant): Option[String] =
21242124
if constant.tag == dotc.core.Constants.StringTag then Some(constant.stringValue)
21252125
else None
21262126
end String
21272127

2128-
object Unit extends ConstantUnitModule:
2128+
object Unit extends UnitModule:
21292129
def apply(): Constant = dotc.core.Constants.Constant(())
21302130
def unapply(constant: Constant): Boolean =
21312131
constant.tag == dotc.core.Constants.UnitTag
21322132
end Unit
21332133

2134-
object Null extends ConstantNullModule:
2134+
object Null extends NullModule:
21352135
def apply(): Constant = dotc.core.Constants.Constant(null)
21362136
def unapply(constant: Constant): Boolean =
21372137
constant.tag == dotc.core.Constants.NullTag
21382138
end Null
21392139

2140-
object ClassOf extends ConstantClassOfModule:
2140+
object ClassOf extends ClassOfModule:
21412141
def apply(x: TypeRepr): Constant =
21422142
// TODO check that the type is a valid class when creating this constant or let Ycheck do it?
21432143
dotc.core.Constants.Constant(x)
@@ -2397,7 +2397,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
23972397
end extension
23982398
end SignatureMethodsImpl
23992399

2400-
object defn extends DefnModule:
2400+
object defn extends defnModule:
24012401
def RootPackage: Symbol = dotc.core.Symbols.defn.RootPackage
24022402
def RootClass: Symbol = dotc.core.Symbols.defn.RootClass
24032403
def EmptyPackageClass: Symbol = dotc.core.Symbols.defn.EmptyPackageClass
@@ -2541,7 +2541,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
25412541
def path: java.nio.file.Path = ctx.compilationUnit.source.file.jpath
25422542
end Source
25432543

2544-
object report extends ReportModule:
2544+
object report extends reportModule:
25452545

25462546
def error(msg: String): Unit =
25472547
dotc.report.error(msg, Position.ofMacroExpansion)

0 commit comments

Comments
 (0)