Skip to content

Commit ca6f417

Browse files
committed
Merge pull request scala#37 from gkossakowski/merge
Merge changes from upstream
2 parents ff9a35f + 5dca2a0 commit ca6f417

File tree

299 files changed

+4931
-8870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+4931
-8870
lines changed

META-INF/MANIFEST.MF

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Export-Package:
4242
scala.reflect.internal,
4343
scala.reflect.internal.settings,
4444
scala.reflect.runtime,
45-
scala.reflect.std,
4645
scala.reflect.internal.transform,
4746
ch.epfl.lamp.compiler.msil,
4847
ch.epfl.lamp.compiler.msil.emit,

build.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,12 +1664,13 @@ BOOTRAPING TEST AND TEST SUITE
16641664
</target>
16651665

16661666
<target name="test.scaladoc" depends="pack.done">
1667-
<partest erroronfailed="yes" scalacopts="${scalac.args.optimise}">
1667+
<partest erroronfailed="yes" scalacopts="${scalac.args.optimise}"
1668+
showlog="yes">
16681669
<compilationpath>
16691670
<path refid="pack.classpath"/>
16701671
</compilationpath>
16711672
<scalachecktests dir="test/scaladoc/scala">
1672-
<include name="*.scala"/>
1673+
<include name="**/*.scala"/>
16731674
</scalachecktests>
16741675
</partest>
16751676
</target>

lib/scala-compiler.jar.desired.sha1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9361bf724565fdb20937e22c7dc4e6c67ff82221 ?scala-compiler.jar
1+
14a0987b7538c3aadcfa9160965076dfe118ec0d ?scala-compiler.jar
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b0308ec2747d2e1614a000298dacccdd78e57c2d ?scala-library-src.jar
1+
6207899bfc2c03c7c9d014e332475eb313062e3c ?scala-library-src.jar

lib/scala-library.jar.desired.sha1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1489cddb0e70ade4a03766ab3f9811697294ab0a ?scala-library.jar
1+
f374329f89c77e8205a377060b21cf97ace5ac9b ?scala-library.jar

src/attic/scala/tools/nsc/models/SemanticTokens.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import scala.tools.nsc.Global
1414
import scala.tools.nsc.symtab.{Flags, Names}
1515
import scala.tools.nsc.symtab.Flags.DEFERRED
1616
import scala.tools.nsc.util.{BatchSourceFile, SourceFile}
17-
import scala.reflect.NameTransformer
1817

1918
class SemanticTokens(val compiler: Global) {
2019
import compiler._
@@ -160,7 +159,7 @@ class SemanticTokens(val compiler: Global) {
160159
else new Info(symbol)
161160

162161
abstract class Semantic(val symbol: Symbol) extends Actual {
163-
val name = NameTransformer.decode(symbol.name.toString).trim()
162+
val name = symbol.name.decode.toString.trim
164163
assert(symbol != NoSymbol)
165164
def myOuter = Process.this
166165

@@ -503,7 +502,7 @@ class SemanticTokens(val compiler: Global) {
503502
//Thread.dumpStack()
504503
}
505504
else if (term != NoSymbol) {
506-
val name = NameTransformer.decode(term.name.toString).trim()
505+
val name = term.name.decode.toString.trim
507506
val buf = unit.source.asInstanceOf[BatchSourceFile].content
508507
val cs = name.toChars
509508
var idx = 0

src/attic/scala/tools/nsc/models/Signatures.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import scala.collection.mutable.{HashMap, HashSet}
1010
import scala.tools.nsc.{Global => Compiler}
1111
import scala.tools.nsc.symtab.{Flags, Names}
1212
import scala.tools.nsc.util.{ Position, SourceFile }
13-
import scala.reflect.NameTransformer
1413

1514
/** This class ...
1615
*

src/compiler/scala/reflect/internal/ClassfileConstants.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ object ClassfileConstants {
321321
final val impdep1 = 0xfe
322322
final val impdep2 = 0xff
323323

324-
def toScalaFlags(flags: Int, isClass: Boolean): Long = {
324+
def toScalaFlags(flags: Int, isClass: Boolean = false, isField: Boolean = false): Long = {
325325
import Flags._
326326
var res = 0l
327327
if ((flags & JAVA_ACC_PRIVATE) != 0)
@@ -340,8 +340,9 @@ object ClassfileConstants {
340340
if ((flags & JAVA_ACC_STATIC) != 0)
341341
res = res | STATIC
342342
if (isClass && ((res & DEFERRED) != 0L))
343-
res = res & ~DEFERRED | ABSTRACT
344-
343+
res = res & ~DEFERRED | ABSTRACT
344+
if (isField && (res & FINAL) == 0L)
345+
res = res | MUTABLE
345346
res | JAVA
346347
}
347348
}

src/compiler/scala/reflect/internal/Definitions.scala

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,13 @@ trait Definitions extends reflect.api.StandardDefinitions {
142142
lazy val EmptyPackage = RootClass.newPackage(NoPosition, nme.EMPTY_PACKAGE_NAME).setFlag(FINAL)
143143
lazy val EmptyPackageClass = EmptyPackage.moduleClass
144144

145-
lazy val JavaLangPackage = getModule(sn.JavaLang)
146-
lazy val ScalaPackage = getModule("scala")
147-
lazy val ScalaPackageClass = ScalaPackage.tpe.typeSymbol
145+
lazy val JavaLangPackage = getModule(sn.JavaLang)
146+
lazy val JavaLangPackageClass = JavaLangPackage.moduleClass
147+
lazy val ScalaPackage = getModule(nme.scala_)
148+
lazy val ScalaPackageClass = ScalaPackage.moduleClass
148149

149150
lazy val RuntimePackage = getModule("scala.runtime")
150-
lazy val RuntimePackageClass = RuntimePackage.tpe.typeSymbol
151+
lazy val RuntimePackageClass = RuntimePackage.moduleClass
151152

152153
// convenient one-argument parameter lists
153154
lazy val anyparam = List(AnyClass.typeConstructor)
@@ -156,21 +157,7 @@ trait Definitions extends reflect.api.StandardDefinitions {
156157

157158
// private parameter conveniences
158159
private def booltype = BooleanClass.typeConstructor
159-
private def boolparam = List(booltype)
160-
private def bytetype = ByteClass.typeConstructor
161-
private def byteparam = List(bytetype)
162-
private def shorttype = ShortClass.typeConstructor
163-
private def shortparam = List(shorttype)
164160
private def inttype = IntClass.typeConstructor
165-
private def intparam = List(inttype)
166-
private def longtype = LongClass.typeConstructor
167-
private def longparam = List(longtype)
168-
private def floattype = FloatClass.typeConstructor
169-
private def floatparam = List(floattype)
170-
private def doubletype = DoubleClass.typeConstructor
171-
private def doubleparam = List(doubletype)
172-
private def chartype = CharClass.typeConstructor
173-
private def charparam = List(chartype)
174161
private def stringtype = StringClass.typeConstructor
175162

176163
// top types
@@ -209,19 +196,19 @@ trait Definitions extends reflect.api.StandardDefinitions {
209196
lazy val ElidableMethodClass = getClass("scala.annotation.elidable")
210197
lazy val ImplicitNotFoundClass = getClass("scala.annotation.implicitNotFound")
211198
lazy val VarargsClass = getClass("scala.annotation.varargs")
212-
lazy val FieldTargetClass = getClass("scala.annotation.target.field")
213-
lazy val GetterTargetClass = getClass("scala.annotation.target.getter")
214-
lazy val SetterTargetClass = getClass("scala.annotation.target.setter")
215-
lazy val BeanGetterTargetClass = getClass("scala.annotation.target.beanGetter")
216-
lazy val BeanSetterTargetClass = getClass("scala.annotation.target.beanSetter")
217-
lazy val ParamTargetClass = getClass("scala.annotation.target.param")
199+
lazy val FieldTargetClass = getClass("scala.beans.meta.field")
200+
lazy val GetterTargetClass = getClass("scala.beans.meta.getter")
201+
lazy val SetterTargetClass = getClass("scala.beans.meta.setter")
202+
lazy val BeanGetterTargetClass = getClass("scala.beans.meta.beanGetter")
203+
lazy val BeanSetterTargetClass = getClass("scala.beans.meta.beanSetter")
204+
lazy val ParamTargetClass = getClass("scala.beans.meta.param")
218205
lazy val ScalaInlineClass = getClass("scala.inline")
219206
lazy val ScalaNoInlineClass = getClass("scala.noinline")
220207
lazy val SpecializedClass = getClass("scala.specialized")
221208
lazy val BridgeClass = getClass("scala.annotation.bridge")
222209

223210
// fundamental reference classes
224-
lazy val ScalaObjectClass = getClass("scala.ScalaObject")
211+
lazy val ScalaObjectClass = getMember(ScalaPackageClass, tpnme.ScalaObject)
225212
lazy val PartialFunctionClass = getClass("scala.PartialFunction")
226213
lazy val SymbolClass = getClass("scala.Symbol")
227214
lazy val StringClass = getClass(sn.String)
@@ -233,9 +220,17 @@ trait Definitions extends reflect.api.StandardDefinitions {
233220
// fundamental modules
234221
lazy val SysPackage = getPackageObject("scala.sys")
235222
def Sys_error = getMember(SysPackage, nme.error)
223+
224+
// Modules whose members are in the default namespace
225+
lazy val UnqualifiedModules = List(PredefModule, ScalaPackage, JavaLangPackage)
226+
// Those modules and their module classes
227+
lazy val UnqualifiedOwners = UnqualifiedModules.toSet ++ UnqualifiedModules.map(_.moduleClass)
228+
236229
lazy val PredefModule: Symbol = getModule("scala.Predef")
237-
lazy val PredefModuleClass = PredefModule.tpe.typeSymbol
238-
def Predef_AnyRef = getMember(PredefModule, "AnyRef") // used by the specialization annotation
230+
lazy val PredefModuleClass = PredefModule.moduleClass
231+
// Note: this is not the type alias AnyRef, it's a val defined in Predef
232+
// used by the @specialize annotation.
233+
def Predef_AnyRef = getMember(PredefModule, nme.AnyRef)
239234
def Predef_classOf = getMember(PredefModule, nme.classOf)
240235
def Predef_identity = getMember(PredefModule, nme.identity)
241236
def Predef_conforms = getMember(PredefModule, nme.conforms)
@@ -297,6 +292,12 @@ trait Definitions extends reflect.api.StandardDefinitions {
297292
def isVarArgsList(params: List[Symbol]) = params.nonEmpty && isRepeatedParamType(params.last.tpe)
298293
def isVarArgTypes(formals: List[Type]) = formals.nonEmpty && isRepeatedParamType(formals.last)
299294

295+
def hasRepeatedParam(tp: Type): Boolean = tp match {
296+
case MethodType(formals, restpe) => isScalaVarArgs(formals) || hasRepeatedParam(restpe)
297+
case PolyType(_, restpe) => hasRepeatedParam(restpe)
298+
case _ => false
299+
}
300+
300301
def isPrimitiveArray(tp: Type) = tp match {
301302
case TypeRef(_, ArrayClass, arg :: Nil) => isValueClass(arg.typeSymbol)
302303
case _ => false
@@ -420,6 +421,7 @@ trait Definitions extends reflect.api.StandardDefinitions {
420421
lazy val ProductClass = mkArityArray("Product", MaxProductArity)
421422
lazy val FunctionClass = mkArityArray("Function", MaxFunctionArity, 0)
422423
lazy val AbstractFunctionClass = mkArityArray("runtime.AbstractFunction", MaxFunctionArity, 0)
424+
lazy val isProductNClass = ProductClass.toSet
423425

424426
def tupleField(n: Int, j: Int) = getMember(TupleClass(n), "_" + j)
425427
def isTupleType(tp: Type): Boolean = isTupleType(tp, false)
@@ -454,11 +456,7 @@ trait Definitions extends reflect.api.StandardDefinitions {
454456
def productProj(n: Int, j: Int): Symbol = productProj(ProductClass(n), j)
455457

456458
/** returns true if this type is exactly ProductN[T1,...,Tn], not some subclass */
457-
def isExactProductType(tp: Type): Boolean = cond(tp.normalize) {
458-
case TypeRef(_, sym, elems) =>
459-
val len = elems.length
460-
len <= MaxProductArity && sym == ProductClass(len)
461-
}
459+
def isExactProductType(tp: Type): Boolean = isProductNClass(tp.typeSymbol)
462460

463461
def productType(elems: List[Type]) = {
464462
if (elems.isEmpty) UnitClass.tpe
@@ -472,15 +470,16 @@ trait Definitions extends reflect.api.StandardDefinitions {
472470
}
473471
}
474472

475-
/** if tpe <: ProductN[T1,...,TN], returns Some((T1,...,TN)) else None */
476-
def getProductArgs(tpe: Type): Option[List[Type]] =
477-
tpe.baseClasses collectFirst { case x if isExactProductType(x.tpe) => tpe.baseType(x).typeArgs }
473+
/** if tpe <: ProductN[T1,...,TN], returns List(T1,...,TN) else Nil */
474+
def getProductArgs(tpe: Type): List[Type] = tpe.baseClasses find isProductNClass match {
475+
case Some(x) => tpe.baseType(x).typeArgs
476+
case _ => Nil
477+
}
478478

479-
def unapplyUnwrap(tpe:Type) = (tpe match {
480-
case PolyType(_,MethodType(_, res)) => res
481-
case MethodType(_, res) => res
482-
case tpe => tpe
483-
}).normalize
479+
def unapplyUnwrap(tpe:Type) = tpe.finalResultType.normalize match {
480+
case RefinedType(p :: _, _) => p.normalize
481+
case tp => tp
482+
}
484483

485484
def functionApply(n: Int) = getMember(FunctionClass(n), nme.apply)
486485
def functionType(formals: List[Type], restpe: Type) = {
@@ -514,8 +513,8 @@ trait Definitions extends reflect.api.StandardDefinitions {
514513
case _ => NoType
515514
}
516515

517-
def seqType(arg: Type) = typeRef(SeqClass.typeConstructor.prefix, SeqClass, List(arg))
518-
def arrayType(arg: Type) = typeRef(ArrayClass.typeConstructor.prefix, ArrayClass, List(arg))
516+
def seqType(arg: Type) = appliedType(SeqClass.typeConstructor, List(arg))
517+
def arrayType(arg: Type) = appliedType(ArrayClass.typeConstructor, List(arg))
519518
def byNameType(arg: Type) = appliedType(ByNameParamClass.typeConstructor, List(arg))
520519

521520
def ClassType(arg: Type) =
@@ -635,7 +634,7 @@ trait Definitions extends reflect.api.StandardDefinitions {
635634
getPackageObject(fullname).companionClass
636635

637636
def getPackageObject(fullname: Name): Symbol =
638-
getModuleOrClass(fullname.toTermName).info.member(newTermName("package"))
637+
getModule(fullname).info member nme.PACKAGE
639638

640639
def getModule(fullname: Name): Symbol =
641640
getModuleOrClass(fullname.toTermName)
@@ -666,7 +665,9 @@ trait Definitions extends reflect.api.StandardDefinitions {
666665

667666
private def getModuleOrClass(path: Name, len: Int): Symbol = {
668667
val point = path lastPos('.', len - 1)
669-
val owner = if (point > 0) getModuleOrClass(path.toTermName, point) else RootClass
668+
val owner =
669+
if (point > 0) getModuleOrClass(path.toTermName, point)
670+
else RootClass
670671
val name = path subName (point + 1, len)
671672
val sym = owner.info member name
672673
val result = if (path.isTermName) sym.suchThat(_ hasFlag MODULE) else sym
@@ -750,6 +751,9 @@ trait Definitions extends reflect.api.StandardDefinitions {
750751
/** Is symbol a phantom class for which no runtime representation exists? */
751752
lazy val isPhantomClass = Set[Symbol](AnyClass, AnyValClass, NullClass, NothingClass)
752753

754+
/** Is the symbol that of a parent which is added during parsing? */
755+
lazy val isPossibleSyntheticParent = ProductClass.toSet[Symbol] + ProductRootClass + SerializableClass
756+
753757
private lazy val scalaValueClassesSet = ScalaValueClasses.toSet
754758
private lazy val boxedValueClassesSet = boxedClass.values.toSet + BoxedUnitClass
755759

0 commit comments

Comments
 (0)