diff --git a/compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala b/compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala index 7c64df6e0e69..927851a8ed2c 100644 --- a/compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala +++ b/compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala @@ -2561,27 +2561,6 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext: def Definitions_InternalQuotedMatcher_patternTypeAnnot: Symbol = dotc.core.Symbols.defn.InternalQuotedMatcher_patternTypeAnnot def Definitions_InternalQuotedMatcher_fromAboveAnnot: Symbol = dotc.core.Symbols.defn.InternalQuotedMatcher_fromAboveAnnot - def Definitions_UnitType: Type = dotc.core.Symbols.defn.UnitType - def Definitions_ByteType: Type = dotc.core.Symbols.defn.ByteType - def Definitions_ShortType: Type = dotc.core.Symbols.defn.ShortType - def Definitions_CharType: Type = dotc.core.Symbols.defn.CharType - def Definitions_IntType: Type = dotc.core.Symbols.defn.IntType - def Definitions_LongType: Type = dotc.core.Symbols.defn.LongType - def Definitions_FloatType: Type = dotc.core.Symbols.defn.FloatType - def Definitions_DoubleType: Type = dotc.core.Symbols.defn.DoubleType - def Definitions_BooleanType: Type = dotc.core.Symbols.defn.BooleanType - def Definitions_AnyType: Type = dotc.core.Symbols.defn.AnyType - def Definitions_AnyValType: Type = dotc.core.Symbols.defn.AnyValType - def Definitions_AnyRefType: Type = dotc.core.Symbols.defn.AnyRefType - def Definitions_ObjectType: Type = dotc.core.Symbols.defn.ObjectType - def Definitions_NothingType: Type = dotc.core.Symbols.defn.NothingType - def Definitions_NullType: Type = dotc.core.Symbols.defn.NullType - def Definitions_StringType: Type = dotc.core.Symbols.defn.StringType - def Definitions_TupleType: Type = dotc.core.Symbols.defn.TupleTypeRef - def Definitions_EmptyTupleType: Type = dotc.core.Symbols.defn.EmptyTupleModule.termRef - def Definitions_NonEmptyTupleType: Type = dotc.core.Symbols.defn.NonEmptyTupleClass.typeRef - def Definitions_TupleConsType: Type = dotc.core.Symbols.defn.PairClass.typeRef - def betaReduce(tree: Term): Option[Term] = tree match case app @ tpd.Apply(tpd.Select(fn, nme.apply), args) if dotc.core.Symbols.defn.isFunctionType(fn.tpe) => diff --git a/library/src-bootstrapped/scala/internal/quoted/Type.scala b/library/src-bootstrapped/scala/internal/quoted/Type.scala index 31b09209ea3d..05ddb3f4c2bc 100644 --- a/library/src-bootstrapped/scala/internal/quoted/Type.scala +++ b/library/src-bootstrapped/scala/internal/quoted/Type.scala @@ -46,49 +46,34 @@ object Type { new Matcher.QuoteMatcher[qctx2.type](qctx2).typeTreeMatch(scrutineeType.unseal, patternType.unseal, hasTypeSplices).asInstanceOf[Option[Tup]] } - def Unit: QuoteContext ?=> quoted.Type[Unit] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_UnitType.seal.asInstanceOf[quoted.Type[Unit]] + // TODO generalize following optimizations for all classes without parameters - def Boolean: QuoteContext ?=> quoted.Type[Boolean] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_BooleanType.seal.asInstanceOf[quoted.Type[Boolean]] + def Unit: QuoteContext ?=> quoted.Type[Unit] = + qctx.tasty.Type.typeConstructorOf(classOf[Unit]).seal.asInstanceOf[quoted.Type[Unit]] + def Boolean: QuoteContext ?=> quoted.Type[Boolean] = + qctx.tasty.Type.typeConstructorOf(classOf[Boolean]).seal.asInstanceOf[quoted.Type[Boolean]] def Byte: QuoteContext ?=> quoted.Type[Byte] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_ByteType.seal.asInstanceOf[quoted.Type[Byte]] - + qctx.tasty.Type.typeConstructorOf(classOf[Byte]).seal.asInstanceOf[quoted.Type[Byte]] def Char: QuoteContext ?=> quoted.Type[Char] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_CharType.seal.asInstanceOf[quoted.Type[Char]] - + qctx.tasty.Type.typeConstructorOf(classOf[Char]).seal.asInstanceOf[quoted.Type[Char]] def Short: QuoteContext ?=> quoted.Type[Short] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_ShortType.seal.asInstanceOf[quoted.Type[Short]] - + qctx.tasty.Type.typeConstructorOf(classOf[Short]).seal.asInstanceOf[quoted.Type[Short]] def Int: QuoteContext ?=> quoted.Type[Int] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_IntType.seal.asInstanceOf[quoted.Type[Int]] - + qctx.tasty.Type.typeConstructorOf(classOf[Int]).seal.asInstanceOf[quoted.Type[Int]] def Long: QuoteContext ?=> quoted.Type[Long] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_LongType.seal.asInstanceOf[quoted.Type[Long]] - + qctx.tasty.Type.typeConstructorOf(classOf[Long]).seal.asInstanceOf[quoted.Type[Long]] def Float: QuoteContext ?=> quoted.Type[Float] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_FloatType.seal.asInstanceOf[quoted.Type[Float]] - + qctx.tasty.Type.typeConstructorOf(classOf[Float]).seal.asInstanceOf[quoted.Type[Float]] def Double: QuoteContext ?=> quoted.Type[Double] = - val qctx1 = quoteContextWithCompilerInterface(qctx) - qctx1.tasty.Definitions_DoubleType.seal.asInstanceOf[quoted.Type[Double]] - + qctx.tasty.Type.typeConstructorOf(classOf[Double]).seal.asInstanceOf[quoted.Type[Double]] } diff --git a/library/src/scala/internal/tasty/CompilerInterface.scala b/library/src/scala/internal/tasty/CompilerInterface.scala index 1c01bef097c9..68c6d886b3bf 100644 --- a/library/src/scala/internal/tasty/CompilerInterface.scala +++ b/library/src/scala/internal/tasty/CompilerInterface.scala @@ -42,33 +42,6 @@ trait CompilerInterface { self: scala.tasty.Reflection => /** Symbol of scala.internal.CompileTime.fromAbove */ def Definitions_InternalQuotedMatcher_fromAboveAnnot: Symbol - /** The type of primitive type `Unit`. */ - def Definitions_UnitType: Type - - /** The type of primitive type `Byte`. */ - def Definitions_ByteType: Type - - /** The type of primitive type `Short`. */ - def Definitions_ShortType: Type - - /** The type of primitive type `Char`. */ - def Definitions_CharType: Type - - /** The type of primitive type `Int`. */ - def Definitions_IntType: Type - - /** The type of primitive type `Long`. */ - def Definitions_LongType: Type - - /** The type of primitive type `Float`. */ - def Definitions_FloatType: Type - - /** The type of primitive type `Double`. */ - def Definitions_DoubleType: Type - - /** The type of primitive type `Boolean`. */ - def Definitions_BooleanType: Type - /** Returns Some with a beta-reduced application or None */ def betaReduce(tree: Term): Option[Term]