Skip to content

Commit b067da1

Browse files
authored
Merge pull request #3848 from dotty-staging/fix-ci-failure
Revert "Fix #3782: Fix type parameter inference with scala.Singleton"
2 parents d8b72b2 + af6d756 commit b067da1

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,10 @@ trait ConstraintHandling {
272272

273273
// Then, approximate by (1.) - (3.) and simplify as follows.
274274
// 1. If instance is from below and is a singleton type, yet upper bound is
275-
// not a singleton type or a subtype of `scala.Singleton`, widen the
275+
// not a singleton type or a reference to `scala.Singleton`, widen the
276276
// instance.
277277
if (fromBelow && isMultiSingleton(inst) && !isMultiSingleton(upperBound)
278-
&& !isSubTypeWhenFrozen(upperBound, defn.SingletonType))
278+
&& !upperBound.isRef(defn.SingletonClass))
279279
inst = inst.widen
280280

281281
// 2. If instance is from below and is a fully-defined union type, yet upper bound

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ class Definitions {
387387
enterCompleteClassSymbol(
388388
ScalaPackageClass, tpnme.Singleton, PureInterfaceCreationFlags | Final,
389389
List(AnyClass.typeRef), EmptyScope)
390-
lazy val SingletonType: TypeRef = SingletonClass.typeRef
391390

392391
lazy val SeqType: TypeRef = ctx.requiredClassRef("scala.collection.Seq")
393392
def SeqClass(implicit ctx: Context) = SeqType.symbol.asClass

tests/pos/singletontrait.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
object Test {
22
def foo[T <: Singleton](x: T): T = x
3-
def bar[T <: Int with Singleton](x: T): T = x
43

54
val a: 1 = foo(1)
6-
val b: 1 = bar(1)
75
}

0 commit comments

Comments
 (0)