Skip to content

Commit b4ba804

Browse files
authored
Merge branch 'master' into jline-remove
2 parents 9279ae7 + bef40b4 commit b4ba804

File tree

6 files changed

+28
-11
lines changed

6 files changed

+28
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ We invite you to help us build the future of Scala.<br>
7777
This is the best moment to participate, as everyone can make an impact.<br>
7878

7979
####SI-2712?
80-
If scalac will put it into 2.12, we’ll mimic their behaviour. But we have bigger plans for
80+
Since scalac merged a fix into 2.12, we’ll mimic their behaviour. But we have bigger plans for
8181
HK-types.
8282

8383

src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class ScalaSettings extends Settings.SettingGroup {
2727
val g = ChoiceSetting("-g", "level", "Set level of generated debugging info.", List("none", "source", "line", "vars", "notailcalls"), "vars")
2828
val help = BooleanSetting("-help", "Print a synopsis of standard options")
2929
val nowarn = BooleanSetting("-nowarn", "Generate no warnings.")
30-
val print = BooleanSetting("-print", "Print program with Scala-specific features removed.")
3130
val color = ChoiceSetting("-color", "mode", "Colored output", List("always", "never"/*, "auto"*/), "always"/* "auto"*/)
3231
val target = ChoiceSetting("-target", "target", "Target platform for object files. All JVM 1.5 targets are deprecated.",
3332
List("jvm-1.5", "jvm-1.5-fjbg", "jvm-1.5-asm", "jvm-1.6", "jvm-1.7", "jvm-1.8", "msil"),

src/dotty/tools/dotc/core/Constants.scala

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,19 @@ object Constants {
167167
/** Convert constant value to conform to given type.
168168
*/
169169
def convertTo(pt: Type)(implicit ctx: Context): Constant = {
170-
def lowerBound(pt: Type): Type = pt.dealias.stripTypeVar match {
171-
case tref: TypeRef if !tref.symbol.isClass => lowerBound(tref.info.bounds.lo)
172-
case param: PolyParam => lowerBound(ctx.typerState.constraint.nonParamBounds(param).lo)
170+
def classBound(pt: Type): Type = pt.dealias.stripTypeVar match {
171+
case tref: TypeRef if !tref.symbol.isClass => classBound(tref.info.bounds.lo)
172+
case param: PolyParam =>
173+
ctx.typerState.constraint.entry(param) match {
174+
case TypeBounds(lo, hi) =>
175+
if (hi.classSymbol.isPrimitiveValueClass) hi //constrain further with high bound
176+
else lo
177+
case NoType => param.binder.paramBounds(param.paramNum).lo
178+
case inst => classBound(inst)
179+
}
173180
case pt => pt
174181
}
175-
val target = lowerBound(pt).typeSymbol
182+
val target = classBound(pt).typeSymbol
176183
if (target == tpe.typeSymbol)
177184
this
178185
else if ((target == defn.ByteClass) && isByteRange)

src/dotty/tools/dotc/printing/SyntaxHighlighting.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,15 @@ object SyntaxHighlighting {
7777
(n: @switch) match {
7878
case '/' =>
7979
if (remaining.nonEmpty) {
80-
takeChar() match {
81-
case '/' => eolComment()
82-
case '*' => blockComment()
83-
case x => newBuf += '/'; remaining = x #:: remaining
80+
remaining.head match {
81+
case '/' =>
82+
takeChar()
83+
eolComment()
84+
case '*' =>
85+
takeChar()
86+
blockComment()
87+
case x =>
88+
newBuf += '/'
8489
}
8590
} else newBuf += '/'
8691
case '=' =>

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
566566
def typedIf(tree: untpd.If, pt: Type)(implicit ctx: Context) = track("typedIf") {
567567
val cond1 = typed(tree.cond, defn.BooleanType)
568568
val thenp1 = typed(tree.thenp, pt)
569-
val elsep1 = typed(tree.elsep orElse untpd.unitLiteral withPos tree.pos, pt)
569+
val elsep1 = typed(tree.elsep orElse (untpd.unitLiteral withPos tree.pos), pt)
570570
val thenp2 :: elsep2 :: Nil = harmonize(thenp1 :: elsep1 :: Nil)
571571
assignType(cpy.If(tree)(cond1, thenp2, elsep2), thenp2, elsep2)
572572
}

tests/pos/i1366.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Test {
2+
3+
val a: Char = 98
4+
val c: (Char, Char) = ('a', 98)
5+
6+
}

0 commit comments

Comments
 (0)