Skip to content

Commit 32a2068

Browse files
committed
Merge commit 'refs/pull/543/head'; commit 'refs/pull/544/head'; commit 'refs/pull/546/head' into develop
3 parents 5797aab + 4af7703 + b19dfd8 commit 32a2068

File tree

135 files changed

+640
-514
lines changed

Some content is hidden

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

135 files changed

+640
-514
lines changed

lib/scala-compiler.jar.desired.sha1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c020eccb8cf37963725985f36b44d070915cf4d2 ?scala-compiler.jar
1+
5b3f50d124f84dcda869e17fb0cfd605ed40f385 ?scala-compiler.jar

lib/scala-library.jar.desired.sha1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
31c7188cef85c28b84b9ce35bc6780996e5dd139 ?scala-library.jar
1+
8f19876a8908e7d7d2a140a8434805cfec2c1346 ?scala-library.jar

src/compiler/scala/reflect/internal/Symbols.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3054,7 +3054,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
30543054
override def originalEnclosingMethod = this
30553055

30563056
override def owner: Symbol =
3057-
abort("no-symbol does not have an owner (this is a bug: scala " + scala.util.Properties.versionString + ")")
3057+
abort("no-symbol does not have an owner")
30583058
override def typeConstructor: Type =
30593059
abort("no-symbol does not have a type constructor (this may indicate scalac cannot find fundamental classes)")
30603060
}

src/compiler/scala/tools/ant/templates/tool-unix.tmpl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@
99
##############################################################################
1010

1111
findScalaHome () {
12-
# see #2092
12+
# see SI-2092
1313
local SOURCE="${BASH_SOURCE[0]}"
1414
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
15-
( cd -P "$( dirname "$SOURCE" )"/.. && pwd )
15+
local bindir="$( dirname "$SOURCE" )"
16+
if [[ -d "$bindir"/.. ]]; then
17+
( cd -P "$bindir"/.. && pwd )
18+
else
19+
# See SI-5792
20+
local dir=$(dirname "${BASH_SOURCE[0]}")
21+
local link=$(dirname "$(readlink "${BASH_SOURCE[0]}")")
22+
local path="$dir/$link/.."
23+
( cd "$path" && pwd )
24+
fi
1625
}
1726
execCommand () {
1827
[[ -n $SCALA_RUNNER_DEBUG ]] && echo "" && for arg in "$@@"; do echo "$arg"; done && echo "";

src/compiler/scala/tools/nsc/Global.scala

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,28 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
130130
object nodePrinters extends {
131131
val global: Global.this.type = Global.this
132132
} with NodePrinters {
133+
var lastPrintedPhase: Phase = NoPhase
134+
var lastPrintedSource: String = ""
133135
infolevel = InfoLevel.Verbose
136+
137+
def showUnit(unit: CompilationUnit) {
138+
print(" // " + unit.source)
139+
if (unit.body == null) println(": tree is null")
140+
else {
141+
val source = util.stringFromWriter(w => newTreePrinter(w) print unit.body)
142+
143+
// treePrinter show unit.body
144+
if (lastPrintedSource == source)
145+
println(": tree is unchanged since " + lastPrintedPhase)
146+
else {
147+
lastPrintedPhase = phase.prev // since we're running inside "afterPhase"
148+
lastPrintedSource = source
149+
println("")
150+
println(source)
151+
println("")
152+
}
153+
}
154+
}
134155
}
135156

136157
def withInfoLevel[T](infolevel: nodePrinters.InfoLevel.Value)(op: => T) = {
@@ -1588,8 +1609,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
15881609
} // class Run
15891610

15901611
def printAllUnits() {
1591-
print("[[syntax trees at end of " + phase + "]]")
1592-
afterPhase(phase) { currentRun.units foreach (treePrinter.print(_)) }
1612+
print("[[syntax trees at end of %25s]]".format(phase))
1613+
afterPhase(phase)(currentRun.units foreach { unit =>
1614+
nodePrinters showUnit unit
1615+
})
15931616
}
15941617

15951618
/** We resolve the class/object ambiguity by passing a type/term name.

src/compiler/scala/tools/nsc/typechecker/Implicits.scala

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,16 +1133,27 @@ trait Implicits {
11331133
* An EmptyTree is returned if materialization fails.
11341134
*/
11351135
private def tagOfType(pre: Type, tp: Type, tagClass: Symbol): SearchResult = {
1136-
def success(arg: Tree) =
1136+
def success(arg: Tree) = {
1137+
def isMacroException(msg: String): Boolean =
1138+
// [Eugene] very unreliable, ask Hubert about a better way
1139+
msg contains "exception during macro expansion"
1140+
1141+
def processMacroExpansionError(pos: Position, msg: String): SearchResult = {
1142+
// giving up and reporting all macro exceptions regardless of their source
1143+
// this might lead to an avalanche of errors if one of your implicit macros misbehaves
1144+
if (isMacroException(msg)) context.error(pos, msg)
1145+
failure(arg, "failed to typecheck the materialized tag: %n%s".format(msg), pos)
1146+
}
1147+
11371148
try {
11381149
val tree1 = typed(atPos(pos.focus)(arg))
1139-
def isErroneous = tree exists (_.isErroneous)
1140-
if (context.hasErrors) failure(tp, "failed to typecheck the materialized typetag: %n%s".format(context.errBuffer.head.errMsg), context.errBuffer.head.errPos)
1150+
if (context.hasErrors) processMacroExpansionError(context.errBuffer.head.errPos, context.errBuffer.head.errMsg)
11411151
else new SearchResult(tree1, EmptyTreeTypeSubstituter)
11421152
} catch {
11431153
case ex: TypeError =>
1144-
failure(arg, "failed to typecheck the materialized typetag: %n%s".format(ex.msg), ex.pos)
1154+
processMacroExpansionError(ex.pos, ex.msg)
11451155
}
1156+
}
11461157

11471158
val prefix = (
11481159
// ClassTags only exist for scala.reflect.mirror, so their materializer

0 commit comments

Comments
 (0)