Skip to content

Commit 9149cc9

Browse files
committed
Merge pull request scala#4368 from som-snytt/review/7784
SI-7784 Allow a singleton type over a constant value defn.
2 parents d30098c + 2030f3a commit 9149cc9

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5193,7 +5193,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
51935193
if (refTyped.isErrorTyped) {
51945194
setError(tree)
51955195
} else {
5196-
tree setType refTyped.tpe.resultType
5196+
tree setType refTyped.tpe.resultType.deconst
51975197
if (refTyped.isErrorTyped || treeInfo.admitsTypeSelection(refTyped)) tree
51985198
else UnstableTreeError(tree)
51995199
}

test/files/neg/logImplicits.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ logImplicits.scala:2: applied implicit conversion from xs.type to ?{def size: ?}
44
logImplicits.scala:7: applied implicit conversion from String("abc") to ?{def map: ?} = implicit def augmentString(x: String): scala.collection.immutable.StringOps
55
def f = "abc" map (_ + 1)
66
^
7-
logImplicits.scala:15: inferred view from String("abc") to Int = C.this.convert:(p: String("abc"))Int
7+
logImplicits.scala:15: inferred view from String("abc") to Int = C.this.convert:(p: String)Int
88
math.max(122, x: Int)
99
^
1010
logImplicits.scala:19: applied implicit conversion from Int(1) to ?{def ->: ?} = implicit def ArrowAssoc[A](self: A): ArrowAssoc[A]

test/files/pos/t7784.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
object Test {
2+
final val a = ""
3+
var b: a.type = a
4+
b = a
5+
6+
final val x = classOf[Object]
7+
var y: x.type = x
8+
y = x
9+
10+
final val e = Thread.State.NEW
11+
var e1: e.type = e
12+
e1 = e
13+
}

0 commit comments

Comments
 (0)