File tree Expand file tree Collapse file tree 5 files changed +30
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 5 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -371,6 +371,7 @@ object StdNames {
371
371
val Import : N = " Import"
372
372
val Literal : N = " Literal"
373
373
val LiteralAnnotArg : N = " LiteralAnnotArg"
374
+ val Matchable : N = " Matchable"
374
375
val MatchCase : N = " MatchCase"
375
376
val MirroredElemTypes : N = " MirroredElemTypes"
376
377
val MirroredElemLabels : N = " MirroredElemLabels"
@@ -387,7 +388,6 @@ object StdNames {
387
388
val Ref : N = " Ref"
388
389
val RootPackage : N = " RootPackage"
389
390
val RootClass : N = " RootClass"
390
- val Matchable : N = " Matchable"
391
391
val Select : N = " Select"
392
392
val Shape : N = " Shape"
393
393
val StringContext : N = " StringContext"
Original file line number Diff line number Diff line change @@ -141,4 +141,4 @@ class ReTyper extends Typer with ReChecking {
141
141
override protected def addAccessorDefs (cls : Symbol , body : List [Tree ])(using Context ): List [Tree ] = body
142
142
override protected def checkEqualityEvidence (tree : tpd.Tree , pt : Type )(using Context ): Unit = ()
143
143
override protected def matchingApply (methType : MethodOrPoly , pt : FunProto )(using Context ): Boolean = true
144
- }
144
+ }
Original file line number Diff line number Diff line change @@ -3375,6 +3375,9 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
3375
3375
/** The class symbol of core class `scala.Any`. */
3376
3376
def AnyClass : Symbol
3377
3377
3378
+ /** The class symbol of core trait `scala.Matchable` */
3379
+ def MatchableClass : Symbol
3380
+
3378
3381
/** The class symbol of core class `scala.AnyVal`. */
3379
3382
def AnyValClass : Symbol
3380
3383
Original file line number Diff line number Diff line change
1
+ trait M0 extends Matchable // inferred base type is AnyRef
2
+ trait M extends Any , Matchable
3
+
4
+ class C extends Matchable // OK inferred base type is AnyRef
5
+ class D (x : Int ) extends AnyVal , Matchable // OK
6
+ class E extends AnyRef , Matchable // OK
7
+ class F extends Any , Matchable // error: Any does not have a constructor
8
+
9
+ class C1 extends M // OK inferred base type is AnyRef
10
+ class D1 (x : Int ) extends AnyVal , M // OK
11
+ class E1 extends AnyRef , M // OK
12
+ class F1 extends Any , M // error: Any does not have a constructor
13
+
14
+ class C2 extends M0 // OK inferred base type is AnyRef
15
+ class D2 (x : Int ) extends AnyVal , M0 // error: illegal trait inheritance
16
+ class E2 extends AnyRef , M0 // OK
17
+ class F2 extends Any , M0 // error: Any does not have a constructor // error: illegal trait inheritance
18
+
19
+
20
+
21
+
22
+
23
+
Original file line number Diff line number Diff line change 1
1
object Test {
2
2
def f [X ](x : X ) =
3
+ ??? .getClass.getMethods.head.getParameterTypes.mkString(" ," )
4
+ // this is the current behavior. But it would also be OK if `???.getClass` fails
3
5
x.getClass.getMethods.head.getParameterTypes.mkString(" ," )
4
6
}
You can’t perform that action at this time.
0 commit comments