1
- object tasty {
1
+ package tasty
2
+
3
+ object definitions {
2
4
3
5
// ------ Names --------------------------------
4
6
@@ -8,16 +10,13 @@ object tasty {
8
10
enum TermName extends Name with PossiblySignedName {
9
11
case Simple (str : String )
10
12
case Qualified (prefix : TermName , selector : String ) // s"$prefix.$name"
11
- case Unique ( underlying : TermName , separator : String , idx : Int ) // s"$underlying$separator$idx"
13
+
12
14
case DefaultGetter (methodName : TermName , idx : String ) // s"$methodName${"$default$"}${idx+1}"
13
15
case Variant (underlying : TermName , covariant : Boolean ) // s"${if (covariant) "+" else "-"}$underlying"
14
16
case SuperAccessor (underlying : TermName ) // s"${"super$"}$underlying"
15
17
case ProtectedAccessor (underlying : TermName ) // s"${"protected$"}$underlying"
16
18
case ProtectedSetter (underlying : TermName ) // s"${"protected$set"}$underlying"
17
19
case ObjectClass (underlying : TermName ) // s"$underlying${"$"}"
18
-
19
- case Expanded (prefix : TermName , selector : String ) // s"$prefix${"$$"}$name" , used only for symbols coming from Scala 2
20
- case ExpandedPrefix (prefix : TermName , selector : String ) // s"$prefix${"$"}$name" , used only for symbols coming from Scala 2
21
20
}
22
21
23
22
case class SignedName (name : TermName , resultSig : TypeName , paramSigs : List [TypeName ]) extends PossiblySignedName
@@ -131,7 +130,7 @@ object tasty {
131
130
case class SymRef (sym : Definition , qualifier : Type | NoPrefix = NoPrefix ) extends Type
132
131
case class NameRef (name : Name , qualifier : Type | NoPrefix = NoPrefix ) extends Type // NoPrefix means: select from _root_
133
132
case class SuperType (thistp : Type , underlying : Type ) extends Type
134
- case class Refinement (underlying : Type , name : Name , tpe : Type ) extends Type
133
+ case class Refinement (underlying : Type , name : Name , tpe : Type | TypeBounds ) extends Type
135
134
case class AppliedType (tycon : Type , args : List [Type | TypeBounds ]) extends Type
136
135
case class AnnotatedType (underlying : Type , annotation : Term ) extends Type
137
136
case class AndType (left : Type , right : Type ) extends Type
@@ -153,7 +152,7 @@ object tasty {
153
152
154
153
abstract class LambdaType [ParamName , ParamInfo , This <: LambdaType [ParamName , ParamInfo , This ]](
155
154
val companion : LambdaTypeCompanion [ParamName , ParamInfo , This ]
156
- ) {
155
+ ) extends Type {
157
156
private [Type ] var _pinfos : List [ParamInfo ]
158
157
private [Type ] var _restpe : Type
159
158
@@ -247,28 +246,3 @@ object tasty {
247
246
case Enum (v : Type ) extends Constant (v)
248
247
}
249
248
}
250
-
251
- object Test {
252
- import tasty ._
253
- import Type ._
254
-
255
- def show (tp : Type ): String = tp match {
256
- case ConstantType (c) => c.value.toString
257
- case SymRef (sym, NoPrefix ) => ???
258
- case SymRef (sym, t : Type ) => ???
259
- case NameRef (name : Name , qualifier) => ???
260
- case SuperType (thistp : Type , underlying : Type ) => ???
261
- case Refinement (underlying : Type , name : Name , tpe : Type ) => ???
262
- case AppliedType (tycon, args) => ???
263
- case AnnotatedType (underlying : Type , annotation : Term ) => ???
264
- case AndType (left : Type , right : Type ) => ???
265
- case OrType (left : Type , right : Type ) => ???
266
- case ByNameType (underlying : Type ) => ???
267
- case ParamRef (binder, idx) => ???
268
- case RecursiveThis (binder : RecursiveType ) => ???
269
- case RecursiveType (tp) => ???
270
- case MethodType (pnames, ptypes, resType) => ???
271
- case PolyType (pnames, ptypes, resType) => ???
272
- case TypeLambda (pnames, ptypes, resType) => ???
273
- }
274
- }
0 commit comments