Skip to content

Commit e4645f7

Browse files
authored
Merge pull request scala#8786 from szeiger/wip/merge-to-2.13.x
Merge from 2.12.x to 2.13.x
2 parents a20345d + f37efeb commit e4645f7

File tree

7 files changed

+41
-31
lines changed

7 files changed

+41
-31
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
- sbt -Dscala.build.compileWithDotty=true library/compile
3333

3434
# pull request validation (w/ mini-bootstrap)
35+
# "mini" in these senses:
36+
# - it doesn't use the complicated legacy scripts.
37+
# - it doesn't publish to scala-pr-validation-snapshots
38+
# (because we need secrets for that and Travis-CI doesn't give PR jobs access to secrets)
39+
# it is still a true bootstrap.
3540
- stage: build
3641
name: "JDK 8 pr validation"
3742
if: type = pull_request

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

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,30 +2777,29 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
27772777

27782778
/** String representation of symbol's definition following its name */
27792779
final def infoString(tp: Type): String = {
2780-
def parents = (
2781-
if (settings.debug.value) parentsString(tp.parents)
2782-
else briefParentsString(tp.parents)
2783-
)
2784-
def isStructuralThisType = (
2785-
// prevents disasters like scala/bug#8158
2786-
owner.isInitialized && owner.isStructuralRefinement && tp == owner.tpe
2787-
)
2788-
if (isType) typeParamsString(tp) + (
2789-
if (isClass) " extends " + parents
2790-
else if (isAliasType) " = " + tp.resultType
2791-
else tp.resultType match {
2792-
case rt @ TypeBounds(_, _) => "" + rt
2793-
case rt => " <: " + rt
2780+
def loop(tp: Type, followsParens: Boolean): String = {
2781+
def isStructuralThisType = owner.isInitialized && owner.isStructuralRefinement && tp == owner.tpe // scala/bug#8158
2782+
// colon+space, preceded by an extra space if needed to prevent the colon glomming onto a symbolic name
2783+
def postnominalColon: String = if (!followsParens && name.isOperatorName) " : " else ": "
2784+
def parents = if (settings.debug) parentsString(tp.parents) else briefParentsString(tp.parents)
2785+
def typeRest =
2786+
if (isClass) " extends " + parents
2787+
else if (isAliasType) " = " + tp.resultType
2788+
else tp.resultType match {
2789+
case rt@TypeBounds(_, _) => "" + rt
2790+
case rt => " <: " + rt
2791+
}
2792+
tp match {
2793+
case _ if isType => typeParamsString(tp) + typeRest
2794+
case _ if isModule => "" // avoid "object X of type X.type"
2795+
case PolyType(tparams, res) => typeParamsString(tp) + loop(res, followsParens = true)
2796+
case NullaryMethodType(res) => loop(res, followsParens = false)
2797+
case MethodType(params, res) => valueParamsString(tp) + loop(res, followsParens = true)
2798+
case _ if isStructuralThisType => postnominalColon + owner.name
2799+
case _ => postnominalColon + tp
27942800
}
2795-
)
2796-
else if (isModule) "" // avoid "object X of type X.type"
2797-
else tp match {
2798-
case PolyType(tparams, res) => typeParamsString(tp) + infoString(res)
2799-
case NullaryMethodType(res) => infoString(res)
2800-
case MethodType(params, res) => valueParamsString(tp) + infoString(res)
2801-
case _ if isStructuralThisType => ": " + owner.name
2802-
case _ => ": " + tp
28032801
}
2802+
loop(tp, followsParens = false)
28042803
}
28052804

28062805
def infosString = infos.toString

test/files/neg/abstract-report2.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Missing implementations for 13 members. Stub implementations follow:
5252

5353
class Baz[T] extends Collection[T]
5454
^
55-
abstract-report2.scala:15: error: class Dingus needs to be abstract.
55+
abstract-report2.scala:21: error: class Dingus needs to be abstract.
5656
Missing implementations for 7 members. Stub implementations follow:
5757
// Members declared in scala.collection.IterableOnce
5858
def iterator: Iterator[(Set[Int], String)] = ???

test/files/neg/abstract-report2.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ trait Xyz[T] {
1010
def foo(x: T): Boolean
1111
}
1212

13+
trait Symbolic {
14+
def --? : Int
15+
def --!(i: Int): Unit
16+
def unary_~ : Long
17+
}
18+
1319
trait Bippy[T1, T2, T3] extends collection.IterableOps[(T2, String), List, List[(T2, String)]] with Xyz[T3]
1420

1521
class Dingus extends Bippy[String, Set[Int], List[Int]]

test/files/neg/logImplicits.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ logImplicits.scala:9: applied implicit conversion from String("abc") to ?{def ma
77
logImplicits.scala:17: inferred view from String("abc") to Int via C.this.convert: (p: "abc"): Int
88
math.max(122, x: Int)
99
^
10-
logImplicits.scala:21: applied implicit conversion from Int(1) to ?{def ->: ?} = final implicit def ArrowAssoc[A](self: A): ArrowAssoc[A]
10+
logImplicits.scala:21: applied implicit conversion from Int(1) to ?{def -> : ?} = final implicit def ArrowAssoc[A](self: A): ArrowAssoc[A]
1111
def f = (1 -> 2) + "c"
1212
^
13-
logImplicits.scala:21: applied implicit conversion from (Int, Int) to ?{def +: ?} = final implicit def any2stringadd[A](self: A): any2stringadd[A]
13+
logImplicits.scala:21: applied implicit conversion from (Int, Int) to ?{def + : ?} = final implicit def any2stringadd[A](self: A): any2stringadd[A]
1414
def f = (1 -> 2) + "c"
1515
^
1616
logImplicits.scala:24: error: class Un needs to be abstract. Missing implementation for:

test/files/presentation/infix-completion.check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ def toOctalString: String
158158
def toRadians: Double
159159
def toShort: Short
160160
def toString(): String
161-
def unary_+: Int
162-
def unary_-: Int
163-
def unary_~: Int
161+
def unary_+ : Int
162+
def unary_- : Int
163+
def unary_~ : Int
164164
def until(end: Int): scala.collection.immutable.Range
165165
def until(end: Int, step: Int): scala.collection.immutable.Range
166166
def until(end: Long): scala.collection.immutable.NumericRange.Exclusive[Long]

test/files/presentation/infix-completion2.check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ def toOctalString: String
158158
def toRadians: Double
159159
def toShort: Short
160160
def toString(): String
161-
def unary_+: Int
162-
def unary_-: Int
163-
def unary_~: Int
161+
def unary_+ : Int
162+
def unary_- : Int
163+
def unary_~ : Int
164164
def until(end: Int): scala.collection.immutable.Range
165165
def until(end: Int, step: Int): scala.collection.immutable.Range
166166
def until(end: Long): scala.collection.immutable.NumericRange.Exclusive[Long]

0 commit comments

Comments
 (0)