Skip to content

Commit 107e87f

Browse files
committed
Merge remote-tracking branches 'axel22/issue/5293' and 'jsuereth/fix-5053-view-unzip' into develop
2 parents 832e317 + ab07db1 commit 107e87f

File tree

29 files changed

+703
-230
lines changed

29 files changed

+703
-230
lines changed

build.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ INITIALISATION
213213
<property name="scalac.args.optimise" value=""/>
214214
<!-- scalac.args.quickonly are added to quick.* targets but not others (particularly, locker.)
215215
This is to facilitate testing new command line options which do not yet exist in starr. -->
216-
<property name="scalac.args.quickonly" value=""/>
217-
216+
<property name="scalac.args.quickonly" value=""/>
218217
<property name="scalac.args.all" value="${scalac.args} ${scalac.args.optimise}"/>
219218
<property name="scalac.args.quick" value="${scalac.args.all} ${scalac.args.quickonly}"/>
220219
<!-- Setting-up Ant contrib tasks -->
@@ -233,15 +232,14 @@ INITIALISATION
233232
<exec osfamily="windows" executable="tools/get-scala-revision.bat" outputproperty="git.describe" failifexecutionfails="false" />
234233
<!-- some default in case something went wrong getting the revision -->
235234
<property name="git.describe" value="-unknown-"/>
236-
237235
<property name="init.avail" value="yes"/>
238236

239237
<!-- Generating version number -->
240238
<property file="${basedir}/build.number"/>
241239
<property
242240
name="version.number"
243241
value="${version.major}.${version.minor}.${version.patch}.${git.describe}"/>
244-
242+
245243
<!-- And print-out what we are building -->
246244
<echo message=" build time: ${time.human}" />
247245
<echo message=" java version: ${java.vm.name} ${java.version}" />

src/compiler/scala/reflect/internal/Chars.scala

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,31 @@ trait Chars {
2121
final val SU = '\u001A'
2222

2323
/** Convert a character digit to an Int according to given base,
24-
* -1 if no success */
24+
* -1 if no success
25+
*/
2526
def digit2int(ch: Char, base: Int): Int = {
26-
if ('0' <= ch && ch <= '9' && ch < '0' + base)
27-
ch - '0'
28-
else if ('A' <= ch && ch < 'A' + base - 10)
29-
ch - 'A' + 10
30-
else if ('a' <= ch && ch < 'a' + base - 10)
31-
ch - 'a' + 10
32-
else
33-
-1
27+
val num = (
28+
if (ch <= '9') ch - '0'
29+
else if ('a' <= ch && ch <= 'z') ch - 'a' + 10
30+
else if ('A' <= ch && ch <= 'Z') ch - 'A' + 10
31+
else -1
32+
)
33+
if (0 <= num && num < base) num else -1
3434
}
35+
/** Buffer for creating '\ u XXXX' strings. */
36+
private[this] val char2uescapeArray = Array[Char]('\\', 'u', 0, 0, 0, 0)
3537

3638
/** Convert a character to a backslash-u escape */
3739
def char2uescape(c: Char): String = {
38-
var rest = c.toInt
39-
val buf = new StringBuilder
40-
for (i <- 1 to 4) {
41-
buf ++= (rest % 16).toHexString
42-
rest = rest / 16
43-
}
44-
"\\u" + buf.toString.reverse
40+
@inline def hexChar(ch: Int): Char =
41+
( if (ch < 10) '0' else 'A' - 10 ) + ch toChar
42+
43+
char2uescapeArray(2) = hexChar((c >> 12) )
44+
char2uescapeArray(3) = hexChar((c >> 8) % 16)
45+
char2uescapeArray(4) = hexChar((c >> 4) % 16)
46+
char2uescapeArray(5) = hexChar((c ) % 16)
47+
48+
new String(char2uescapeArray)
4549
}
4650

4751
/** Is character a line break? */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,10 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
10971097
def typeParams: List[Symbol] =
10981098
if (isMonomorphicType) Nil
10991099
else {
1100+
// analogously to the "info" getter, here we allow for two completions:
1101+
// one: sourceCompleter to LazyType, two: LazyType to completed type
1102+
if (validTo == NoPeriod)
1103+
atPhase(phaseOf(infos.validFrom))(rawInfo load this)
11001104
if (validTo == NoPeriod)
11011105
atPhase(phaseOf(infos.validFrom))(rawInfo load this)
11021106

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ goto :eof
8686

8787
:end
8888
@@endlocal
89+
exit /b %errorlevel%

src/compiler/scala/tools/nsc/ast/DocComments.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ trait DocComments { self: Global =>
9999
*/
100100
def useCases(sym: Symbol, site: Symbol): List[(Symbol, String, Position)] = {
101101
def getUseCases(dc: DocComment) = {
102-
for (uc <- dc.useCases; defn <- uc.expandedDefs(site)) yield
102+
for (uc <- dc.useCases; defn <- uc.expandedDefs(sym, site)) yield
103103
(defn,
104104
expandVariables(merge(cookedDocComment(sym), uc.comment.raw, defn), sym, site),
105105
uc.pos)
@@ -346,7 +346,7 @@ trait DocComments { self: Global =>
346346
var defined: List[Symbol] = List() // initialized by Typer
347347
var aliases: List[Symbol] = List() // initialized by Typer
348348

349-
def expandedDefs(site: Symbol): List[Symbol] = {
349+
def expandedDefs(sym: Symbol, site: Symbol): List[Symbol] = {
350350

351351
def select(site: Type, name: Name, orElse: => Type): Type = {
352352
val member = site.nonPrivateMember(name)
@@ -424,8 +424,10 @@ trait DocComments { self: Global =>
424424
}
425425

426426
for (defn <- defined) yield {
427-
defn.cloneSymbol.setFlag(Flags.SYNTHETIC).setInfo(
428-
substAliases(defn.info).asSeenFrom(site.thisType, defn.owner))
427+
val useCase = defn.cloneSymbol
428+
useCase.owner = sym.owner
429+
useCase.flags = sym.flags
430+
useCase.setFlag(Flags.SYNTHETIC).setInfo(substAliases(defn.info).asSeenFrom(site.thisType, sym.owner))
429431
}
430432
}
431433
}

src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,15 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
100100
if (inTpl == null) None else thisFactory.comment(sym, inTpl)
101101
override def inTemplate = inTpl
102102
override def toRoot: List[MemberImpl] = this :: inTpl.toRoot
103-
def inDefinitionTemplates =
104-
if (inTpl == null)
105-
makeRootPackage.toList
106-
else
107-
makeTemplate(sym.owner) :: (sym.allOverriddenSymbols map { inhSym => makeTemplate(inhSym.owner) })
103+
def inDefinitionTemplates = this match {
104+
case mb: NonTemplateMemberEntity if (mb.useCaseOf.isDefined) =>
105+
mb.useCaseOf.get.inDefinitionTemplates
106+
case _ =>
107+
if (inTpl == null)
108+
makeRootPackage.toList
109+
else
110+
makeTemplate(sym.owner) :: (sym.allOverriddenSymbols map { inhSym => makeTemplate(inhSym.owner) })
111+
}
108112
def visibility = {
109113
if (sym.isPrivateLocal) PrivateInInstance()
110114
else if (sym.isProtectedLocal) ProtectedInInstance()
@@ -119,18 +123,14 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
119123
else Public()
120124
}
121125
}
122-
def flags = this match {
123-
// workaround for uninitialized flags in use cases - see SI-5054
124-
case m: NonTemplateMemberEntity if (m.useCaseOf.isDefined) =>
125-
m.useCaseOf.get.flags
126-
case _ =>
127-
val fgs = mutable.ListBuffer.empty[Paragraph]
128-
if (sym.isImplicit) fgs += Paragraph(Text("implicit"))
129-
if (sym.isSealed) fgs += Paragraph(Text("sealed"))
130-
if (!sym.isTrait && (sym hasFlag Flags.ABSTRACT)) fgs += Paragraph(Text("abstract"))
131-
if (!sym.isTrait && (sym hasFlag Flags.DEFERRED)) fgs += Paragraph(Text("abstract"))
132-
if (!sym.isModule && (sym hasFlag Flags.FINAL)) fgs += Paragraph(Text("final"))
133-
fgs.toList
126+
def flags = {
127+
val fgs = mutable.ListBuffer.empty[Paragraph]
128+
if (sym.isImplicit) fgs += Paragraph(Text("implicit"))
129+
if (sym.isSealed) fgs += Paragraph(Text("sealed"))
130+
if (!sym.isTrait && (sym hasFlag Flags.ABSTRACT)) fgs += Paragraph(Text("abstract"))
131+
if (!sym.isTrait && (sym hasFlag Flags.DEFERRED)) fgs += Paragraph(Text("abstract"))
132+
if (!sym.isModule && (sym hasFlag Flags.FINAL)) fgs += Paragraph(Text("final"))
133+
fgs.toList
134134
}
135135
def deprecation =
136136
if (sym.isDeprecated)

src/compiler/scala/tools/nsc/transform/UnCurry.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ abstract class UnCurry extends InfoTransform
374374
assert(toArraySym != NoSymbol)
375375
def getManifest(tp: Type): Tree = {
376376
val manifestOpt = localTyper.findManifest(tp, false)
377-
if (!manifestOpt.tree.isEmpty) manifestOpt.tree
377+
// Don't want bottom types getting any further than this (SI-4024)
378+
if (tp.typeSymbol.isBottomClass) getManifest(AnyClass.tpe)
379+
else if (!manifestOpt.tree.isEmpty) manifestOpt.tree
378380
else if (tp.bounds.hi ne tp) getManifest(tp.bounds.hi)
379381
else localTyper.getManifestTree(tree.pos, tp, false)
380382
}

src/library/scala/collection/TraversableViewLike.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ trait TraversableViewLike[+A,
192192
override def groupBy[K](f: A => K): immutable.Map[K, This] =
193193
thisSeq groupBy f mapValues (xs => newForced(xs))
194194

195+
override def unzip[A1, A2](implicit asPair: A => (A1, A2)) =
196+
(newMapped(x => asPair(x)._1), newMapped(x => asPair(x)._2)) // TODO - Performance improvements.
197+
198+
override def unzip3[A1, A2, A3](implicit asTriple: A => (A1, A2, A3)) =
199+
(newMapped(x => asTriple(x)._1), newMapped(x => asTriple(x)._2), newMapped(x => asTriple(x)._3)) // TODO - Performance improvements.
200+
195201
override def toString = viewToString
196202
}
197203

0 commit comments

Comments
 (0)