summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/ScriptRunner.scala12
-rw-r--r--[-rwxr-xr-x]src/compiler/scala/tools/nsc/ast/DocComments.scala0
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala2
-rw-r--r--[-rwxr-xr-x]src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala0
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala20
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala2
-rw-r--r--[-rwxr-xr-x]src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala0
-rw-r--r--[-rwxr-xr-x]src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala0
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala10
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala6
-rw-r--r--src/compiler/scala/tools/nsc/io/Jar.scala2
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Delambdafy.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala41
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/Logic.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Checkable.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala20
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala16
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala19
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Tags.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala2
-rw-r--r--[-rwxr-xr-x]src/compiler/scala/tools/nsc/util/DocStrings.scala4
-rw-r--r--src/compiler/scala/tools/reflect/ReflectGlobal.scala16
39 files changed, 175 insertions, 72 deletions
diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala
index 6d24b31531..bf93ad30bc 100644
--- a/src/compiler/scala/tools/nsc/ScriptRunner.scala
+++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala
@@ -16,16 +16,16 @@ import util.Exceptional.unwrap
/** An object that runs Scala code in script files.
*
- * <p>For example, here is a complete Scala script on Unix:</pre>
- * <pre>
+ * For example, here is a complete Scala script on Unix:
+ * {{{
* #!/bin/sh
* exec scala "$0" "$@"
* !#
* Console.println("Hello, world!")
* args.toList foreach Console.println
- * </pre>
- * <p>And here is a batch file example on Windows XP:</p>
- * <pre>
+ * }}}
+ * And here is a batch file example on Windows XP:
+ * {{{
* ::#!
* @echo off
* call scala %0 %*
@@ -33,7 +33,7 @@ import util.Exceptional.unwrap
* ::!#
* Console.println("Hello, world!")
* args.toList foreach Console.println
- * </pre>
+ * }}}
*
* @author Lex Spoon
* @version 1.0, 15/05/2006
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala
index 6442ef2d54..6442ef2d54 100755..100644
--- a/src/compiler/scala/tools/nsc/ast/DocComments.scala
+++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index bf53c47e9a..332acf4a26 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -261,7 +261,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
* Create a method based on a Function
*
* Used both to under `-Ydelambdafy:method` create a lifted function and
- * under `-Ydelamdafy:inline` to create the apply method on the anonymous
+ * under `-Ydelambdafy:inline` to create the apply method on the anonymous
* class.
*
* It creates a method definition with value params cloned from the
diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
index 52b8a51a79..52b8a51a79 100755..100644
--- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 4f195c2985..4494a8ac8d 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -2031,11 +2031,11 @@ self =>
/** Drop `private` modifier when followed by a qualifier.
* Contract `abstract` and `override` to ABSOVERRIDE
*/
- private def normalizeModifers(mods: Modifiers): Modifiers =
+ private def normalizeModifiers(mods: Modifiers): Modifiers =
if (mods.isPrivate && mods.hasAccessBoundary)
- normalizeModifers(mods &~ Flags.PRIVATE)
+ normalizeModifiers(mods &~ Flags.PRIVATE)
else if (mods hasAllFlags (Flags.ABSTRACT | Flags.OVERRIDE))
- normalizeModifers(mods &~ (Flags.ABSTRACT | Flags.OVERRIDE) | Flags.ABSOVERRIDE)
+ normalizeModifiers(mods &~ (Flags.ABSTRACT | Flags.OVERRIDE) | Flags.ABSOVERRIDE)
else
mods
@@ -2080,7 +2080,7 @@ self =>
* AccessModifier ::= (private | protected) [AccessQualifier]
* }}}
*/
- def accessModifierOpt(): Modifiers = normalizeModifers {
+ def accessModifierOpt(): Modifiers = normalizeModifiers {
in.token match {
case m @ (PRIVATE | PROTECTED) => in.nextToken() ; accessQualifierOpt(Modifiers(flagTokens(m)))
case _ => NoMods
@@ -2094,7 +2094,7 @@ self =>
* | override
* }}}
*/
- def modifiers(): Modifiers = normalizeModifers {
+ def modifiers(): Modifiers = normalizeModifiers {
def loop(mods: Modifiers): Modifiers = in.token match {
case PRIVATE | PROTECTED =>
loop(accessQualifierOpt(addMod(mods, flagTokens(in.token), tokenRange(in))))
@@ -2680,7 +2680,10 @@ self =>
case t if t == SUPERTYPE || t == SUBTYPE || t == COMMA || t == RBRACE || isStatSep(t) =>
TypeDef(mods | Flags.DEFERRED, name, tparams, typeBounds())
case _ =>
- syntaxErrorOrIncompleteAnd("`=', `>:', or `<:' expected", skipIt = true)(EmptyTree)
+ syntaxErrorOrIncompleteAnd("`=', `>:', or `<:' expected", skipIt = true)(
+ // assume a dummy type def so as to have somewhere to stash the annotations
+ TypeDef(mods, tpnme.ERROR, Nil, EmptyTree)
+ )
}
}
}
@@ -2713,7 +2716,10 @@ self =>
case CASEOBJECT =>
objectDef(pos, (mods | Flags.CASE) withPosition (Flags.CASE, tokenRange(in.prev /*scanner skips on 'case' to 'object', thus take prev*/)))
case _ =>
- syntaxErrorOrIncompleteAnd("expected start of definition", skipIt = true)(EmptyTree)
+ syntaxErrorOrIncompleteAnd("expected start of definition", skipIt = true)(
+ // assume a class definition so as to have somewhere to stash the annotations
+ atPos(pos)(gen.mkClassDef(mods, tpnme.ERROR, Nil, Template(Nil, noSelfType, Nil)))
+ )
}
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 92833d647b..cd41c75298 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -226,7 +226,7 @@ trait Scanners extends ScannersCommon {
* RPAREN if region starts with '('
* RBRACKET if region starts with '['
* RBRACE if region starts with '{'
- * ARROW if region starts with `case'
+ * ARROW if region starts with 'case'
* STRINGLIT if region is a string interpolation expression starting with '${'
* (the STRINGLIT appears twice in succession on the stack iff the
* expression is a multiline string literal).
diff --git a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
index 67241ef639..67241ef639 100755..100644
--- a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala
diff --git a/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala b/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala
index 6dcfa173df..6dcfa173df 100755..100644
--- a/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 3e23291e92..b6f9bcc9ab 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -2016,7 +2016,7 @@ abstract class GenICode extends SubComponent {
*
* This could result in unreachable code which has to be cleaned up later, e.g. if the try and all the exception
* handlers always end in RETURN then there will be no "normal" flow out of the try/catch/finally.
- * Later reachability analysis will remove unreacahble code.
+ * Later reachability analysis will remove unreachable code.
*/
def Try(body: Context => Context,
handlers: List[(Symbol, TypeKind, Context => Context)],
@@ -2060,7 +2060,7 @@ abstract class GenICode extends SubComponent {
if (settings.YdisableUnreachablePrevention || !outerCtx.bb.ignore) {
if (finalizer != EmptyTree) {
val exh = outerCtx.newExceptionHandler(NoSymbol, finalizer.pos) // finalizer covers exception handlers
- this.addActiveHandler(exh) // .. and body aswell
+ this.addActiveHandler(exh) // .. and body as well
val exhStartCtx = finalizerCtx.enterExceptionHandler(exh)
exhStartCtx.bb killIf outerCtx.bb.ignore
val exception = exhStartCtx.makeLocal(finalizer.pos, ThrowableTpe, "exc")
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
index 843648282b..0f17b5d694 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala
@@ -20,7 +20,7 @@ abstract class ICodeCheckers {
* </p>
* <ul>
* <li>
- * for primitive operations: the type and numer of operands match
+ * for primitive operations: the type and number of operands match
* the type of the operation
* </li>
* <li>
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index 67fc7923ea..416628d5ba 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -92,8 +92,8 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
def genThrow(expr: Tree): BType = {
val thrownKind = tpeTK(expr)
- // `throw null` is valid although scala.Null (as defined in src/libray-aux) isn't a subtype of Throwable.
- // Similarly for scala.Nothing (again, as defined in src/libray-aux).
+ // `throw null` is valid although scala.Null (as defined in src/library-aux) isn't a subtype of Throwable.
+ // Similarly for scala.Nothing (again, as defined in src/library-aux).
assert(thrownKind.isNullType || thrownKind.isNothingType || thrownKind.asClassBType.isSubtypeOf(ThrowableReference).get)
genLoad(expr, thrownKind)
lineNumber(expr)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
index 8720da84e8..0c26e01322 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
@@ -1126,7 +1126,7 @@ object BTypes {
* The map is indexed by the string s"$name$descriptor" (to
* disambiguate overloads).
*
- * @param warning Contains an warning message if an error occured when building this
+ * @param warning Contains an warning message if an error occurred when building this
* InlineInfo, for example if some classfile could not be found on
* the classpath. This warning can be reported later by the inliner.
*/
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index a34ab914ef..4768417c67 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -495,8 +495,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
* generic classes or interfaces.
*
* @param superName the internal of name of the super class. For interfaces,
- * the super class is {@link Object}. May be <tt>null</tt>, but
- * only for the {@link Object} class.
+ * the super class is [[Object]]. May be <tt>null</tt>, but
+ * only for the [[Object]] class.
*
* @param interfaces the internal names of the class's interfaces (see
* {@link Type#getInternalName() getInternalName}). May be
@@ -532,6 +532,10 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
case e: java.lang.RuntimeException if e.getMessage != null && (e.getMessage contains "too large!") =>
reporter.error(sym.pos,
s"Could not write class $jclassName because it exceeds JVM code size limits. ${e.getMessage}")
+ case e: java.io.IOException if e.getMessage != null && (e.getMessage contains "File name too long") =>
+ reporter.error(sym.pos, e.getMessage + "\n" +
+ "This can happen on some encrypted or legacy file systems. Please see SI-3623 for more details.")
+
}
}
@@ -2696,7 +2700,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
case CMPG =>
(kind: @unchecked) match {
case FLOAT => emit(Opcodes.FCMPG)
- case DOUBLE => emit(Opcodes.DCMPL) // TODO bug? why not DCMPG? http://docs.oracle.com/javase/specs/jvms/se5.0/html/Instructions2.doc3.html
+ case DOUBLE => emit(Opcodes.DCMPL) // TODO bug? why not DCMPG? http://docs.oracle.com/javase/specs/jvms/se6/html/Instructions2.doc3.html
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala
index 31710dcbee..31b62f747e 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala
@@ -12,7 +12,7 @@ import scala.tools.nsc.backend.jvm.opt.BytecodeUtils
import BytecodeUtils._
/**
- * Some notes on the ASM ananlyzer framework.
+ * Some notes on the ASM analyzer framework.
*
* Value
* - Abstract, needs to be implemented for each analysis.
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala
index 92b9b34006..b0dc6ead1b 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala
@@ -359,7 +359,7 @@ class ClosureOptimizer[BT <: BTypes](val btypes: BT) {
}
/**
- * Stores a local varaible index the opcode offset required for operating on that variable.
+ * Stores a local variable index the opcode offset required for operating on that variable.
*
* The xLOAD / xSTORE opcodes are in the following sequence: I, L, F, D, A, so the offset for
* a local variable holding a reference (`A`) is 4. See also method `getOpcode` in [[scala.tools.asm.Type]].
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
index 8477f5461a..6b2786c1a3 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
@@ -366,7 +366,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
clonedInstructions.insert(argStores)
- // label for the exit of the inlined functions. xRETURNs are rplaced by GOTOs to this label.
+ // label for the exit of the inlined functions. xRETURNs are replaced by GOTOs to this label.
val postCallLabel = newLabelNode
clonedInstructions.add(postCallLabel)
@@ -705,9 +705,9 @@ class Inliner[BT <: BTypes](val btypes: BT) {
// - a method name+type
//
// execution [3]
- // - resolve the CSP, yielding the boostrap method handle, the static args and the name+type
+ // - resolve the CSP, yielding the bootstrap method handle, the static args and the name+type
// - resolution entails accessibility checking [4]
- // - execute the `invoke` method of the boostrap method handle (which is signature polymorphic, check its javadoc)
+ // - execute the `invoke` method of the bootstrap method handle (which is signature polymorphic, check its javadoc)
// - the descriptor for the call is made up from the actual arguments on the stack:
// - the first parameters are "MethodHandles.Lookup, String, MethodType", then the types of the constant arguments,
// - the return type is CallSite
diff --git a/src/compiler/scala/tools/nsc/io/Jar.scala b/src/compiler/scala/tools/nsc/io/Jar.scala
index 2967f67e9c..efb026cdff 100644
--- a/src/compiler/scala/tools/nsc/io/Jar.scala
+++ b/src/compiler/scala/tools/nsc/io/Jar.scala
@@ -154,7 +154,7 @@ object Jar {
def update(key: Attributes.Name, value: String) = attrs.put(key, value)
}
- // See http://download.java.net/jdk7/docs/api/java/nio/file/Path.html
+ // See http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html
// for some ideas.
private val ZipMagicNumber = List[Byte](80, 75, 3, 4)
private def magicNumberIsZip(f: Path) = f.isFile && (f.toFile.bytes().take(4).toList == ZipMagicNumber)
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 0cdece59e1..1817cfa25a 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -175,6 +175,7 @@ trait ScalaSettings extends AbsScalaSettings
val YconstOptimization = BooleanSetting ("-Yconst-opt", "Perform optimization with constant values.")
val Ycompacttrees = BooleanSetting ("-Ycompact-trees", "Use compact tree printer when displaying trees.")
val noCompletion = BooleanSetting ("-Yno-completion", "Disable tab-completion in the REPL.")
+ val completion = ChoiceSetting ("-Ycompletion", "provider", "Select tab-completion in the REPL.", List("pc","adhoc","none"), "pc")
val Xdce = BooleanSetting ("-Ydead-code", "Perform dead code elimination.")
val debug = BooleanSetting ("-Ydebug", "Increase the quantity of debugging output.")
//val doc = BooleanSetting ("-Ydoc", "Generate documentation")
@@ -366,8 +367,8 @@ trait ScalaSettings extends AbsScalaSettings
*/
val YpresentationVerbose = BooleanSetting("-Ypresentation-verbose", "Print information about presentation compiler tasks.")
val YpresentationDebug = BooleanSetting("-Ypresentation-debug", "Enable debugging output for the presentation compiler.")
- val YpresentationStrict = BooleanSetting("-Ypresentation-strict", "Do not report type errors in sources with syntax errors.")
-
+ val YpresentationAnyThread = BooleanSetting("-Ypresentation-any-thread", "Allow use of the presentation compiler from any thread")
+ val YpresentationStrict = BooleanSetting("-Ypresentation-strict", "Do not report type errors in sources with syntax errors.")
val YpresentationLog = StringSetting("-Ypresentation-log", "file", "Log presentation compiler events into file", "")
val YpresentationReplay = StringSetting("-Ypresentation-replay", "file", "Replay presentation compiler events from file", "")
val YpresentationDelay = IntSetting("-Ypresentation-delay", "Wait number of ms after typing before starting typechecking", 0, Some((0, 999)), str => Some(str.toInt))
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 79776485de..82e7c76409 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -111,7 +111,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure =>
impl setInfo new LazyImplClassType(iface)
}
- /** Return the implementation class of a trait; create a new one of one does not yet exist */
+ /** Return the implementation class of a trait; create a new one if one does not yet exist */
def implClass(iface: Symbol): Symbol = {
iface.info
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index 86685d46de..6a46c65267 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -137,7 +137,7 @@ abstract class Constructors extends Statics with Transform with ast.TreeDSL {
* and thus may only be accessed from value or method definitions owned by the current class
* (ie there's no point drilling down into nested classes).
*
- * (d) regarding candidates in (b), they are accesible from all places listed in (c) and in addition
+ * (d) regarding candidates in (b), they are accessible from all places listed in (c) and in addition
* from nested classes (nested at any number of levels).
*
* In all cases, we're done with traversing as soon as all candidates have been ruled out.
diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
index 5a7f6c52da..ea8c1cbaf6 100644
--- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
+++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
@@ -281,7 +281,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
val parents = addSerializable(abstractFunctionErasedType)
val funOwner = originalFunction.symbol.owner
- // TODO harmonize the naming of delamdafy anon-fun classes with those spun up by Uncurry
+ // TODO harmonize the naming of delambdafy anon-fun classes with those spun up by Uncurry
// - make `anonClass.isAnonymousClass` true.
// - use `newAnonymousClassSymbol` or push the required variations into a similar factory method
// - reinstate the assertion in `Erasure.resolveAnonymousBridgeClash`
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 7a9dfda43e..163c44822e 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -691,9 +691,46 @@ abstract class UnCurry extends InfoTransform
// declared type and assign this to a synthetic val. Later, we'll patch
// the method body to refer to this, rather than the parameter.
val tempVal: ValDef = {
+ // SI-9442: using the "uncurry-erased" type (the one after the uncurry phase) can lead to incorrect
+ // tree transformations. For example, compiling:
+ // ```
+ // def foo(c: Ctx)(l: c.Tree): Unit = {
+ // val l2: c.Tree = l
+ // }
+ // ```
+ // Results in the following AST:
+ // ```
+ // def foo(c: Ctx, l: Ctx#Tree): Unit = {
+ // val l$1: Ctx#Tree = l.asInstanceOf[Ctx#Tree]
+ // val l2: c.Tree = l$1 // no, not really, it's not.
+ // }
+ // ```
+ // Of course, this is incorrect, since `l$1` has type `Ctx#Tree`, which is not a subtype of `c.Tree`.
+ //
+ // So what we need to do is to use the pre-uncurry type when creating `l$1`, which is `c.Tree` and is
+ // correct. Now, there are two additional problems:
+ // 1. when varargs and byname params are involved, the uncurry transformation desugares these special
+ // cases to actual typerefs, eg:
+ // ```
+ // T* ~> Seq[T] (Scala-defined varargs)
+ // T* ~> Array[T] (Java-defined varargs)
+ // =>T ~> Function0[T] (by name params)
+ // ```
+ // we use the DesugaredParameterType object (defined in scala.reflect.internal.transform.UnCurry)
+ // to redo this desugaring manually here
+ // 2. the type needs to be normalized, since `gen.mkCast` checks this (no HK here, just aliases have
+ // to be expanded before handing the type to `gen.mkAttributedCast`, which calls `gen.mkCast`)
+ val info0 =
+ enteringUncurry(p.symbol.info) match {
+ case DesugaredParameterType(desugaredTpe) =>
+ desugaredTpe
+ case tpe =>
+ tpe
+ }
+ val info = info0.normalize
val tempValName = unit freshTermName (p.name + "$")
- val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC).setInfo(p.symbol.info)
- atPos(p.pos)(ValDef(newSym, gen.mkAttributedCast(Ident(p.symbol), p.symbol.info)))
+ val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC).setInfo(info)
+ atPos(p.pos)(ValDef(newSym, gen.mkAttributedCast(Ident(p.symbol), info)))
}
Packed(newParam, tempVal)
}
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
index 49a4990722..62d9c497ba 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
@@ -38,7 +38,7 @@ trait Logic extends Debugging {
padded.transpose.map(alignedColumns).transpose map (_.mkString(sep)) mkString(lineSep)
}
- // http://www.cis.upenn.edu/~cis510/tcl/chap3.pdf
+ // ftp://ftp.cis.upenn.edu/pub/cis511/public_html/Spring04/chap3.pdf
// http://users.encs.concordia.ca/~ta_ahmed/ms_thesis.pdf
// propositional logic with constants and equality
trait PropositionalLogic {
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
index a11906ace1..1331eb6993 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala
@@ -150,7 +150,11 @@ trait TreeAndTypeAnalysis extends Debugging {
acc: List[List[Type]]): List[List[Type]] = wl match {
case hd :: tl =>
val children = enumerateChildren(hd)
- groupChildren(tl ++ children, acc :+ filterChildren(children))
+ // put each trait in a new group, since traits could belong to the same
+ // group as a derived class
+ val (traits, nonTraits) = children.partition(_.isTrait)
+ val filtered = (traits.map(List(_)) ++ List(nonTraits)).map(filterChildren)
+ groupChildren(tl ++ children, acc ++ filtered)
case Nil => acc
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
index fc632e0d0d..309b80f9ba 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
@@ -44,7 +44,7 @@ import scala.language.postfixOps
* which is essentially the intersection of X and |P|, where |P| is
* the erasure of P. If XR <: P, then no warning is emitted.
*
- * We evaluate "X with conform to P" by checking `X <: P_wild, where
+ * We evaluate "X with conform to P" by checking `X <: P_wild`, where
* P_wild is the result of substituting wildcard types in place of
* pattern type variables. This is intentionally stricter than
* (X matchesPattern P), see SI-8597 for motivating test cases.
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 43f2655311..c46bc7444a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -574,19 +574,23 @@ trait Contexts { self: Analyzer =>
/** Issue/buffer/throw the given implicit ambiguity error according to the current mode for error reporting. */
private[typechecker] def issueAmbiguousError(err: AbsAmbiguousTypeError) = reporter.issueAmbiguousError(err)(this)
/** Issue/throw the given error message according to the current mode for error reporting. */
- def error(pos: Position, msg: String) = reporter.error(pos, msg)
+ def error(pos: Position, msg: String) = reporter.error(fixPosition(pos), msg)
/** Issue/throw the given error message according to the current mode for error reporting. */
- def warning(pos: Position, msg: String) = reporter.warning(pos, msg)
- def echo(pos: Position, msg: String) = reporter.echo(pos, msg)
+ def warning(pos: Position, msg: String) = reporter.warning(fixPosition(pos), msg)
+ def echo(pos: Position, msg: String) = reporter.echo(fixPosition(pos), msg)
+ def fixPosition(pos: Position): Position = pos match {
+ case NoPosition => nextEnclosing(_.tree.pos != NoPosition).tree.pos
+ case _ => pos
+ }
def deprecationWarning(pos: Position, sym: Symbol, msg: String): Unit =
- currentRun.reporting.deprecationWarning(pos, sym, msg)
+ currentRun.reporting.deprecationWarning(fixPosition(pos), sym, msg)
def deprecationWarning(pos: Position, sym: Symbol): Unit =
- currentRun.reporting.deprecationWarning(pos, sym) // TODO: allow this to escalate to an error, and implicit search will ignore deprecated implicits
+ currentRun.reporting.deprecationWarning(fixPosition(pos), sym) // TODO: allow this to escalate to an error, and implicit search will ignore deprecated implicits
def featureWarning(pos: Position, featureName: String, featureDesc: String, featureTrait: Symbol, construct: => String = "", required: Boolean): Unit =
- currentRun.reporting.featureWarning(pos, featureName, featureDesc, featureTrait, construct, required)
+ currentRun.reporting.featureWarning(fixPosition(pos), featureName, featureDesc, featureTrait, construct, required)
// nextOuter determines which context is searched next for implicits
@@ -1239,7 +1243,7 @@ trait Contexts { self: Analyzer =>
type Error = AbsTypeError
type Warning = (Position, String)
- def issue(err: AbsTypeError)(implicit context: Context): Unit = handleError(err.errPos, addDiagString(err.errMsg))
+ def issue(err: AbsTypeError)(implicit context: Context): Unit = handleError(context.fixPosition(err.errPos), addDiagString(err.errMsg))
protected def handleError(pos: Position, msg: String): Unit
protected def handleSuppressedAmbiguous(err: AbsAmbiguousTypeError): Unit = ()
@@ -1256,7 +1260,7 @@ trait Contexts { self: Analyzer =>
* - else, let this context reporter decide
*/
final def issueAmbiguousError(err: AbsAmbiguousTypeError)(implicit context: Context): Unit =
- if (context.ambiguousErrors) reporter.error(err.errPos, addDiagString(err.errMsg)) // force reporting... see TODO above
+ if (context.ambiguousErrors) reporter.error(context.fixPosition(err.errPos), addDiagString(err.errMsg)) // force reporting... see TODO above
else handleSuppressedAmbiguous(err)
@inline final def withFreshErrorBuffer[T](expr: => T): T = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 7ec9cd74a4..494e1e49b7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -110,10 +110,10 @@ trait Implicits {
* Ignore their constr field! The list of type constraints returned along with each tree specifies the constraints that
* must be met by the corresponding type parameter in `tpars` (for the returned implicit view to be valid).
*
- * @arg tp from-type for the implicit conversion
- * @arg context search implicits here
- * @arg tpars symbols that should be considered free type variables
- * (implicit search should not try to solve them, just track their constraints)
+ * @param tp from-type for the implicit conversion
+ * @param context search implicits here
+ * @param tpars symbols that should be considered free type variables
+ * (implicit search should not try to solve them, just track their constraints)
*/
def allViewsFrom(tp: Type, context: Context, tpars: List[Symbol]): List[(SearchResult, List[TypeConstraint])] = {
// my untouchable typevars are better than yours (they can't be constrained by them)
@@ -324,8 +324,10 @@ trait Implicits {
*/
class ImplicitSearch(tree: Tree, pt: Type, isView: Boolean, context0: Context, pos0: Position = NoPosition) extends Typer(context0) with ImplicitsContextErrors {
val searchId = implicitSearchId()
- private def typingLog(what: String, msg: => String) =
- typingStack.printTyping(tree, f"[search #$searchId] $what $msg")
+ private def typingLog(what: String, msg: => String) = {
+ if (printingOk(tree))
+ typingStack.printTyping(f"[search #$searchId] $what $msg")
+ }
import infer._
if (Statistics.canEnable) Statistics.incCounter(implicitSearchCount)
@@ -918,7 +920,7 @@ trait Implicits {
/** Returns all eligible ImplicitInfos and their SearchResults in a map.
*/
- def findAll() = linkedMapFrom(eligible)(typedImplicit(_, ptChecked = false, isLocalToCallsite))
+ def findAll() = linkedMapFrom(eligible)(x => try typedImplicit(x, ptChecked = false, isLocalToCallsite) finally context.reporter.clearAll())
/** Returns the SearchResult of the best match.
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index ab9fa26bac..9f7bdf7aff 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1375,7 +1375,7 @@ trait Infer extends Checkable {
* Otherwise, if there is no best alternative, error.
*
* @param argtpes0 contains the argument types. If an argument is named, as
- * "a = 3", the corresponding type is `NamedType("a", Int)'. If the name
+ * "a = 3", the corresponding type is `NamedType("a", Int)`. If the name
* of some NamedType does not exist in an alternative's parameter names,
* the type is replaces by `Unit`, i.e. the argument is treated as an
* assignment expression.
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 99dd81c7e2..3ed128cbc5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -55,6 +55,13 @@ trait Macros extends MacroRuntimes with Traces with Helpers {
def globalSettings = global.settings
+ /** Obtains a `ClassLoader` instance used for macro expansion.
+ *
+ * By default a new `ScalaClassLoader` is created using the classpath
+ * from global and the classloader of self as parent.
+ *
+ * Mirrors with runtime definitions (e.g. Repl) need to adjust this method.
+ */
protected def findMacroClassLoader(): ClassLoader = {
val classpath = global.classPath.asURLs
macroLogVerbose("macro classloader: initializing from -cp: %s".format(classpath))
@@ -658,7 +665,7 @@ trait Macros extends MacroRuntimes with Traces with Helpers {
//
// Situation #2 requires measures to be taken. If we're in it, then noone's going to help us infer
// the undetermined type params. Therefore we need to do something ourselves or otherwise this
- // expandee will forever remaing not expanded (see SI-5692). A traditional way out of this conundrum
+ // expandee will forever remain not expanded (see SI-5692). A traditional way out of this conundrum
// is to call `instantiate` and let the inferencer try to find the way out. It works for simple cases,
// but sometimes, if the inferencer lacks information, it will be forced to approximate.
//
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 0198529ef7..c5abd756f8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1182,11 +1182,23 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
private def eliminateModuleDefs(moduleDef: Tree): List[Tree] = exitingRefchecks {
val ModuleDef(_, _, impl) = moduleDef
val module = moduleDef.symbol
+ val moduleClass = module.moduleClass
val site = module.owner
val moduleName = module.name.toTermName
// The typer doesn't take kindly to seeing this ClassDef; we have to
// set NoType so it will be ignored.
- val cdef = ClassDef(module.moduleClass, impl) setType NoType
+ val cdef = ClassDef(moduleClass, impl) setType NoType
+
+ // This code is related to the fix of SI-9375, which stops adding `readResolve` methods to
+ // non-static (nested) modules. Before the fix, the method would cause the module accessor
+ // to become notPrivate. To prevent binary changes in the 2.11.x branch, we mimic that behavior.
+ // There is a bit of code duplication between here and SyntheticMethods. We cannot call
+ // makeNotPrivate already in SyntheticMethod: that is during type checking, and not all references
+ // are resolved yet, so we cannot rename a definition. This code doesn't exist in the 2.12.x branch.
+ def hasConcreteImpl(name: Name) = moduleClass.info.member(name).alternatives exists (m => !m.isDeferred)
+ val hadReadResolveBeforeSI9375 = moduleClass.isSerializable && !hasConcreteImpl(nme.readResolve)
+ if (hadReadResolveBeforeSI9375)
+ moduleClass.sourceModule.makeNotPrivate(moduleClass.sourceModule.owner)
// Create the module var unless the immediate owner is a class and
// the module var already exists there. See SI-5012, SI-6712.
@@ -1210,7 +1222,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
}
def matchingInnerObject() = {
val newFlags = (module.flags | STABLE) & ~MODULE
- val newInfo = NullaryMethodType(module.moduleClass.tpe)
+ val newInfo = NullaryMethodType(moduleClass.tpe)
val accessor = site.newMethod(moduleName, module.pos, newFlags) setInfoAndEnter newInfo
DefDef(accessor, Select(This(site), module)) :: Nil
@@ -1511,7 +1523,8 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
sym.isSourceMethod &&
sym.isCase &&
sym.name == nme.apply &&
- isClassTypeAccessible(tree)
+ isClassTypeAccessible(tree) &&
+ !tree.tpe.resultType.typeSymbol.primaryConstructor.isLessAccessibleThan(tree.symbol)
if (doTransform) {
tree foreach {
diff --git a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
index ea44b9dc39..92b0719ba3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala
@@ -132,7 +132,7 @@ trait StdAttachments {
/** Marks the tree as a macro impl reference, which is a naked reference to a method.
*
* This is necessary for typechecking macro impl references (see `DefaultMacroCompiler.defaultResolveMacroImpl`),
- * because otherwise typing a naked reference will result in the "follow this method with `_' if you want to
+ * because otherwise typing a naked reference will result in the "follow this method with `_` if you want to
* treat it as a partially applied function" errors.
*
* This mark suppresses adapt except for when the annottee is a macro application.
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 966e8f1abe..1b3f066fc1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -322,6 +322,7 @@ trait SyntheticMethods extends ast.TreeDSL {
clazz.isModuleClass
&& clazz.isSerializable
&& !hasConcreteImpl(nme.readResolve)
+ && clazz.isStatic
)
def synthesize(): List[Tree] = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Tags.scala b/src/compiler/scala/tools/nsc/typechecker/Tags.scala
index 57dc74d2a0..56127f4026 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Tags.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Tags.scala
@@ -36,7 +36,7 @@ trait Tags {
* @param allowMaterialization If true (default) then the resolver is allowed to launch materialization macros when there's no class tag in scope.
* If false then materialization macros are prohibited from running.
*
- * @returns Tree that represents an `scala.reflect.ClassTag` for `tp` if everything is okay.
+ * @return Tree that represents an `scala.reflect.ClassTag` for `tp` if everything is okay.
* EmptyTree if the result contains unresolved (i.e. not spliced) type parameters and abstract type members.
* EmptyTree if `allowMaterialization` is false, and there is no class tag in scope.
*/
@@ -57,7 +57,7 @@ trait Tags {
* @param allowMaterialization If true (default) then the resolver is allowed to launch materialization macros when there's no type tag in scope.
* If false then materialization macros are prohibited from running.
*
- * @returns Tree that represents a `scala.reflect.TypeTag` for `tp` if everything is okay.
+ * @return Tree that represents a `scala.reflect.TypeTag` for `tp` if everything is okay.
* EmptyTree if `concrete` is true and the result contains unresolved (i.e. not spliced) type parameters and abstract type members.
* EmptyTree if `allowMaterialization` is false, and there is no array tag in scope.
*/
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index a7d48ceb89..e8db8309f1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -262,7 +262,14 @@ abstract class TreeCheckers extends Analyzer {
checkedTyped(tree, mode, pt)
)
private def checkedTyped(tree: Tree, mode: Mode, pt: Type): Tree = {
- val typed = wrap(tree)(super.typed(tree, mode, pt))
+ val typed = wrap(tree)(super.typed(tree.clearType(), mode, pt))
+
+ // Vlad: super.typed returns null for package defs, why is that?
+ if (typed eq null)
+ return tree
+
+ if (typed.tpe ne null)
+ assert(!typed.tpe.isErroneous, "Tree has erroneous type: " + typed)
if (tree ne typed)
treesDiffer(tree, typed)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index fd1a6f293f..6b73a538df 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2725,7 +2725,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
*
* If 'T' is not fully defined, it is inferred by type checking
* `apply$body` without a result type before type checking the block.
- * The method's inferred result type is used instead of T`. [See test/files/pos/sammy_poly.scala]
+ * The method's inferred result type is used instead of `T`. [See test/files/pos/sammy_poly.scala]
*
* The `apply` method is identified by the argument `sam`; `S` corresponds to the argument `samClassTp`,
* and `resPt` is derived from `samClassTp` -- it may be fully defined, or not...
@@ -3305,7 +3305,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
// https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.3
//
// One can think of these methods as being infinitely overloaded. We create
- // a ficticious new cloned method symbol for each call site that takes on a signature
+ // a fictitious new cloned method symbol for each call site that takes on a signature
// governed by a) the argument types and b) the expected type
val args1 = typedArgs(args, forArgMode(fun, mode))
val pts = args1.map(_.tpe.deconst)
@@ -3558,6 +3558,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
def typedAnnotation(ann: Tree, mode: Mode = EXPRmode): AnnotationInfo = {
var hasError: Boolean = false
val pending = ListBuffer[AbsTypeError]()
+ def ErroneousAnnotation = new ErroneousAnnotation().setOriginal(ann)
def finish(res: AnnotationInfo): AnnotationInfo = {
if (hasError) {
@@ -4106,7 +4107,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
def resultingTypeTree(tpe: Type) = {
// we need symbol-ful originals for reification
- // hence we go the extra mile to hand-craft tis guy
+ // hence we go the extra mile to hand-craft this guy
val original = arg1 match {
case tt @ TypeTree() if tt.original != null => Annotated(ann, tt.original)
// this clause is needed to correctly compile stuff like "new C @D" or "@(inline @getter)"
@@ -4258,7 +4259,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
// in the special (though common) case where the types are equal, it pays to pack before comparing
// especially virtpatmat needs more aggressive unification of skolemized types
// this breaks src/library/scala/collection/immutable/TrieIterator.scala
- // annotated types need to be lubbed regardless (at least, continations break if you by pass them like this)
+ // annotated types need to be lubbed regardless (at least, continuations break if you bypass them like this)
def samePackedTypes = (
!isPastTyper
&& thenp1.tpe.annotations.isEmpty
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala b/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
index 550fd4e68d..37fbb73b85 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypersTracking.scala
@@ -159,7 +159,7 @@ trait TypersTracking {
// Some trees which are typed with mind-numbing frequency and
// which add nothing by being printed. Did () type to Unit? Let's
// gamble on yes.
- private def printingOk(t: Tree) = printTypings && (settings.debug.value || !noPrint(t))
+ def printingOk(t: Tree) = printTypings && (settings.debug.value || !noPrint(t))
def noPrintTyping(t: Tree) = (t.tpe ne null) || !printingOk(t)
def noPrintAdapt(tree1: Tree, tree2: Tree) = !printingOk(tree1) || (
(tree1.tpe == tree2.tpe)
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index 8d4d07759f..2811520b67 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -22,7 +22,7 @@ import Jar.isJarOrZip
/** <p>
* This module provides star expansion of '-classpath' option arguments, behaves the same as
- * java, see [http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html]
+ * java, see [[http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html]]
* </p>
*
* @author Stepan Koltsov
diff --git a/src/compiler/scala/tools/nsc/util/DocStrings.scala b/src/compiler/scala/tools/nsc/util/DocStrings.scala
index 4ff7067a21..501546b8f6 100755..100644
--- a/src/compiler/scala/tools/nsc/util/DocStrings.scala
+++ b/src/compiler/scala/tools/nsc/util/DocStrings.scala
@@ -37,7 +37,7 @@ object DocStrings {
/** Returns index of string `str` after `start` skipping longest
* sequence of space and tab characters, possibly also containing
* a single `*` character or the `/``**` sequence.
- * @pre start == str.length || str(start) == `\n'
+ * @pre start == str.length || str(start) == `\n`
*/
def skipLineLead(str: String, start: Int): Int =
if (start == str.length) start
@@ -49,7 +49,7 @@ object DocStrings {
else idx
}
- /** Skips to next occurrence of `\n' or to the position after the `/``**` sequence following index `start`.
+ /** Skips to next occurrence of `\n` or to the position after the `/``**` sequence following index `start`.
*/
def skipToEol(str: String, start: Int): Int =
if (start + 2 < str.length && (str charAt start) == '/' && (str charAt (start + 1)) == '*' && (str charAt (start + 2)) == '*') start + 3
diff --git a/src/compiler/scala/tools/reflect/ReflectGlobal.scala b/src/compiler/scala/tools/reflect/ReflectGlobal.scala
index ac63232967..e30d1ed7cd 100644
--- a/src/compiler/scala/tools/reflect/ReflectGlobal.scala
+++ b/src/compiler/scala/tools/reflect/ReflectGlobal.scala
@@ -1,9 +1,11 @@
package scala.tools
package reflect
+import scala.reflect.internal.util.ScalaClassLoader
import scala.tools.nsc.Global
import scala.tools.nsc.reporters.Reporter
import scala.tools.nsc.Settings
+import scala.tools.nsc.typechecker.Analyzer
/** A version of Global that uses reflection to get class
* infos, instead of reading class or source files.
@@ -11,6 +13,20 @@ import scala.tools.nsc.Settings
class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader)
extends Global(currentSettings, reporter) with scala.tools.reflect.ReflectSetup with scala.reflect.runtime.SymbolTable {
+ override lazy val analyzer = new {
+ val global: ReflectGlobal.this.type = ReflectGlobal.this
+ } with Analyzer {
+ /** Obtains the classLoader used for runtime macro expansion.
+ *
+ * Macro expansion can use everything available in [[global.classPath]] or [[rootClassLoader]].
+ * The [[rootClassLoader]] is used to obtain runtime defined macros.
+ */
+ override protected def findMacroClassLoader(): ClassLoader = {
+ val classpath = global.classPath.asURLs
+ ScalaClassLoader.fromURLs(classpath, rootClassLoader)
+ }
+ }
+
override def transformedType(sym: Symbol) =
postErasure.transformInfo(sym,
erasure.transformInfo(sym,