@@ -28,7 +28,7 @@ import tpd._
2828import scala .tools .asm
2929import StdNames .{nme , str }
3030import NameKinds .{DefaultGetterName , ExpandedName }
31-
31+ import Names . TermName
3232
3333class DottyBackendInterface (outputDirectory : AbstractFile , val superCallsMap : Map [Symbol , Set [ClassSymbol ]])(implicit ctx : Context ) extends BackendInterface {
3434 import Symbols .{toDenot , toClassDenot }
@@ -76,7 +76,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
7676 type LabelDef = tpd.DefDef
7777 type Closure = tpd.Closure
7878
79- val NoSymbol = Symbols .NoSymbol
79+ val NoSymbol : Symbols . NoSymbol . type = Symbols .NoSymbol
8080 val NoPosition : Position = Positions .NoPosition
8181 val EmptyTree : Tree = tpd.EmptyTree
8282
@@ -104,11 +104,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
104104 val nme_EQEQ_LOCAL_VAR : Name = StdNames .nme.EQEQ_LOCAL_VAR
105105
106106 // require LambdaMetafactory: scalac uses getClassIfDefined, but we need those always.
107- override lazy val LambdaMetaFactory = ctx.requiredClass(" java.lang.invoke.LambdaMetafactory" )
108- override lazy val MethodHandle = ctx.requiredClass(" java.lang.invoke.MethodHandle" )
107+ override lazy val LambdaMetaFactory : ClassSymbol = ctx.requiredClass(" java.lang.invoke.LambdaMetafactory" )
108+ override lazy val MethodHandle : ClassSymbol = ctx.requiredClass(" java.lang.invoke.MethodHandle" )
109109
110110 val nme_valueOf : Name = StdNames .nme.valueOf
111- val nme_apply = StdNames .nme.apply
111+ val nme_apply : TermName = StdNames .nme.apply
112112 val NothingClass : Symbol = defn.NothingClass
113113 val NullClass : Symbol = defn.NullClass
114114 val ObjectClass : Symbol = defn.ObjectClass
@@ -128,7 +128,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
128128 val LongClass : Symbol = defn.LongClass
129129 val FloatClass : Symbol = defn.FloatClass
130130 val DoubleClass : Symbol = defn.DoubleClass
131- def isArrayClone (tree : Tree ) = tree match {
131+ def isArrayClone (tree : Tree ): Boolean = tree match {
132132 case Select (qual, StdNames .nme.clone_) if qual.tpe.widen.isInstanceOf [JavaArrayType ] => true
133133 case _ => false
134134 }
@@ -146,19 +146,19 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
146146 val String_valueOf : Symbol = defn.String_valueOf_Object
147147 lazy val Predef_classOf : Symbol = defn.ScalaPredefModule .requiredMethod(nme.classOf )
148148
149- lazy val AnnotationRetentionAttr = ctx.requiredClass(" java.lang.annotation.Retention" )
150- lazy val AnnotationRetentionSourceAttr = ctx.requiredClass(" java.lang.annotation.RetentionPolicy" ).linkedClass.requiredValue(" SOURCE" )
151- lazy val AnnotationRetentionClassAttr = ctx.requiredClass(" java.lang.annotation.RetentionPolicy" ).linkedClass.requiredValue(" CLASS" )
152- lazy val AnnotationRetentionRuntimeAttr = ctx.requiredClass(" java.lang.annotation.RetentionPolicy" ).linkedClass.requiredValue(" RUNTIME" )
153- lazy val JavaAnnotationClass = ctx.requiredClass(" java.lang.annotation.Annotation" )
149+ lazy val AnnotationRetentionAttr : ClassSymbol = ctx.requiredClass(" java.lang.annotation.Retention" )
150+ lazy val AnnotationRetentionSourceAttr : TermSymbol = ctx.requiredClass(" java.lang.annotation.RetentionPolicy" ).linkedClass.requiredValue(" SOURCE" )
151+ lazy val AnnotationRetentionClassAttr : TermSymbol = ctx.requiredClass(" java.lang.annotation.RetentionPolicy" ).linkedClass.requiredValue(" CLASS" )
152+ lazy val AnnotationRetentionRuntimeAttr : TermSymbol = ctx.requiredClass(" java.lang.annotation.RetentionPolicy" ).linkedClass.requiredValue(" RUNTIME" )
153+ lazy val JavaAnnotationClass : ClassSymbol = ctx.requiredClass(" java.lang.annotation.Annotation" )
154154
155155 def boxMethods : Map [Symbol , Symbol ] = defn.ScalaValueClasses ().map{x => // @darkdimius Are you sure this should be a def?
156156 (x, Erasure .Boxing .boxMethod(x.asClass))
157157 }.toMap
158158 def unboxMethods : Map [Symbol , Symbol ] =
159159 defn.ScalaValueClasses ().map(x => (x, Erasure .Boxing .unboxMethod(x.asClass))).toMap
160160
161- override def isSyntheticArrayConstructor (s : Symbol ) = {
161+ override def isSyntheticArrayConstructor (s : Symbol ): Boolean = {
162162 s eq defn.newArrayMethod
163163 }
164164
@@ -309,7 +309,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
309309 }
310310
311311 override def emitAnnotations (cw : asm.ClassVisitor , annotations : List [Annotation ], bcodeStore : BCodeHelpers )
312- (innerClasesStore : bcodeStore.BCInnerClassGen ) = {
312+ (innerClasesStore : bcodeStore.BCInnerClassGen ): Unit = {
313313 for (annot <- annotations; if shouldEmitAnnotation(annot)) {
314314 val typ = annot.atp
315315 val assocs = annot.assocs
@@ -326,7 +326,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
326326 }
327327
328328 override def emitAnnotations (mw : asm.MethodVisitor , annotations : List [Annotation ], bcodeStore : BCodeHelpers )
329- (innerClasesStore : bcodeStore.BCInnerClassGen ) = {
329+ (innerClasesStore : bcodeStore.BCInnerClassGen ): Unit = {
330330 for (annot <- annotations; if shouldEmitAnnotation(annot)) {
331331 val typ = annot.atp
332332 val assocs = annot.assocs
@@ -336,7 +336,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
336336 }
337337
338338 override def emitAnnotations (fw : asm.FieldVisitor , annotations : List [Annotation ], bcodeStore : BCodeHelpers )
339- (innerClasesStore : bcodeStore.BCInnerClassGen ) = {
339+ (innerClasesStore : bcodeStore.BCInnerClassGen ): Unit = {
340340 for (annot <- annotations; if shouldEmitAnnotation(annot)) {
341341 val typ = annot.atp
342342 val assocs = annot.assocs
@@ -392,7 +392,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
392392
393393 def emitAsmp : Option [String ] = None
394394
395- def shouldEmitJumpAfterLabels = true
395+ def shouldEmitJumpAfterLabels : Boolean = true
396396
397397 def dumpClasses : Option [String ] =
398398 if (ctx.settings.Ydumpclasses .isDefault) None
@@ -420,7 +420,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
420420
421421 val MODULE_INSTANCE_FIELD : String = str.MODULE_INSTANCE_FIELD
422422
423- def dropModule (str : String ) =
423+ def dropModule (str : String ): String =
424424 if (! str.isEmpty && str.last == '$' ) str.take(str.length - 1 ) else str
425425
426426 def newTermName (prefix : String ): Name = prefix.toTermName
@@ -471,7 +471,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
471471 }
472472
473473 // todo: remove
474- def isMaybeBoxed (sym : Symbol ) = {
474+ def isMaybeBoxed (sym : Symbol ): Boolean = {
475475 (sym == ObjectClass ) ||
476476 (sym == JavaSerializableClass ) ||
477477 (sym == defn.ComparableClass ) ||
@@ -1047,13 +1047,13 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
10471047
10481048 // todo: this product1s should also eventually become name-based pattn matching
10491049 object Literal extends LiteralDeconstructor {
1050- def get = field.const
1050+ def get : Constant = field.const
10511051 }
10521052
10531053 object Throw extends ThrowDeconstructor {
1054- def get = field.args.head
1054+ def get : Tree = field.args.head
10551055
1056- override def unapply (s : Throw ): DottyBackendInterface . this . Throw .type = {
1056+ override def unapply (s : Throw ): Throw .type = {
10571057 if (s.fun.symbol eq defn.throwMethod) {
10581058 field = s
10591059 } else {
@@ -1064,11 +1064,11 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
10641064 }
10651065
10661066 object New extends NewDeconstructor {
1067- def get = field.tpt.tpe
1067+ def get : Type = field.tpt.tpe
10681068 }
10691069
10701070 object This extends ThisDeconstructor {
1071- def get = field.qual.name
1071+ def get : Name = field.qual.name
10721072 def apply (s : Symbol ): This = tpd.This (s.asClass)
10731073 }
10741074
@@ -1088,15 +1088,15 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
10881088 }
10891089
10901090 object Ident extends IdentDeconstructor {
1091- def get = field.name
1091+ def get : Name = field.name
10921092 }
10931093
10941094 object Alternative extends AlternativeDeconstructor {
1095- def get = field.trees
1095+ def get : List [ Tree ] = field.trees
10961096 }
10971097
10981098 object Constant extends ConstantDeconstructor {
1099- def get = field.value
1099+ def get : Any = field.value
11001100 }
11011101 object ThrownException extends ThrownException {
11021102 def unapply (a : Annotation ): Option [Symbol ] = None // todo
@@ -1113,7 +1113,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
11131113 def _2 : List [Symbol ] = field.vparamss.flatMap(_.map(_.symbol))
11141114 def _3 : Tree = field.rhs
11151115
1116- override def unapply (s : LabelDef ): DottyBackendInterface . this . LabelDef .type = {
1116+ override def unapply (s : LabelDef ): LabelDef .type = {
11171117 if (s.symbol is Flags .Label ) this .field = s
11181118 else this .field = null
11191119 this
@@ -1191,9 +1191,9 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
11911191 }
11921192
11931193 object Closure extends ClosureDeconstructor {
1194- def _1 = field.env
1195- def _2 = field.meth
1196- def _3 = {
1194+ def _1 : List [ Tree ] = field.env
1195+ def _2 : Tree = field.meth
1196+ def _3 : Symbol = {
11971197 val t = field.tpt.tpe.typeSymbol
11981198 if (t.exists) t
11991199 else {
@@ -1206,5 +1206,5 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
12061206 }
12071207 }
12081208
1209- def currentUnit = ctx.compilationUnit
1209+ def currentUnit : CompilationUnit = ctx.compilationUnit
12101210}
0 commit comments