Skip to content

Commit 30ec21e

Browse files
committed
Reject all non-type refinements
1 parent d96dc21 commit 30ec21e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,8 @@ trait Implicits { self: Typer =>
904904
private def checkFormal(formal: Type)(implicit ctx: Context): Boolean = {
905905
@tailrec
906906
def loop(tp: Type): Boolean = tp match {
907-
case RefinedType(_, _, _: MethodicType) => false
908-
case RefinedType(parent, _, _) => loop(parent)
907+
case RefinedType(parent, _, _: TypeBounds) => loop(parent)
908+
case RefinedType(_, _, _) => false
909909
case _ => true
910910
}
911911
loop(formal)

tests/neg/mirror-implicit-scope.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ object Test {
1111
val v3 = the[Mirror.Product { type MirroredType = ISB ; def foo: Int }] // error
1212
val v4 = the[Mirror.Product { type MirroredType = ISB ; def foo(i: Int): Int }] // error
1313
val v5 = the[Mirror.Product { type MirroredType = ISB ; def foo[T](t: T): T }] // error // error
14+
val v6 = the[Mirror.Product { type MirroredType = ISB ; val foo: Int }] // error
1415
}

0 commit comments

Comments
 (0)