diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 5e03220467be..941be543b2b6 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -277,11 +277,11 @@ class Definitions { pt => MethodType(List(pt.paramRefs(0)), pt.paramRefs(0)), Final) lazy val Object_clone = enterMethod(ObjectClass, nme.clone_, MethodType(Nil, ObjectType), Protected) lazy val Object_finalize = enterMethod(ObjectClass, nme.finalize_, MethodType(Nil, UnitType), Protected) - lazy val Object_notify = enterMethod(ObjectClass, nme.notify_, MethodType(Nil, UnitType)) - lazy val Object_notifyAll = enterMethod(ObjectClass, nme.notifyAll_, MethodType(Nil, UnitType)) - lazy val Object_wait = enterMethod(ObjectClass, nme.wait_, MethodType(Nil, UnitType)) - lazy val Object_waitL = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: Nil, UnitType)) - lazy val Object_waitLI = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: IntType :: Nil, UnitType)) + lazy val Object_notify = enterMethod(ObjectClass, nme.notify_, MethodType(Nil, UnitType), Final) + lazy val Object_notifyAll = enterMethod(ObjectClass, nme.notifyAll_, MethodType(Nil, UnitType), Final) + lazy val Object_wait = enterMethod(ObjectClass, nme.wait_, MethodType(Nil, UnitType), Final) + lazy val Object_waitL = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: Nil, UnitType), Final) + lazy val Object_waitLI = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: IntType :: Nil, UnitType), Final) def ObjectMethods = List(Object_eq, Object_ne, Object_synchronized, Object_clone, Object_finalize, Object_notify, Object_notifyAll, Object_wait, Object_waitL, Object_waitLI) diff --git a/tests/neg/i3442.scala b/tests/neg/i3442.scala new file mode 100644 index 000000000000..0959be87765e --- /dev/null +++ b/tests/neg/i3442.scala @@ -0,0 +1,18 @@ +class Test { + // Any + override def getClass(): Class[_] = ??? // error + override def ==(that: Any): Boolean = ??? // error + override def != (that: Any): Boolean = ??? // error + override def ##(): Int = ??? // error + override def isInstanceOf[T0]: Boolean = ??? // error + override def asInstanceOf[T0]: T0 = ??? // error + + // AnyRef + override def eq(that: AnyRef): Boolean = ??? // error + override def ne(that: AnyRef): Boolean = ??? // error + override def notify(): Unit = ??? // error + override def notifyAll(): Unit = ??? // error + override def wait(): Unit = ??? // error + override def wait(timeout: Long, nanos: Int): Unit = ??? // error + override def wait(timeout: Long): Unit = ??? // error +}