From b65d67d71c962523cca625a80553571408b2a3e6 Mon Sep 17 00:00:00 2001 From: Den Shabalin Date: Wed, 21 Aug 2013 12:27:45 +0200 Subject: deprecate early type defs This feature is neither properly supported by Scala compiler nor a part of the language spec and therefore should be removed. Due to source compatiblity with 2.10 we need to deprecate it first. --- test/files/neg/macro-invalidusage-presuper.check | 2 +- test/files/neg/t2796.check | 5 ++++- test/files/neg/t2796.flags | 2 +- test/files/neg/t2796.scala | 3 +-- 4 files changed, 7 insertions(+), 5 deletions(-) (limited to 'test/files/neg') diff --git a/test/files/neg/macro-invalidusage-presuper.check b/test/files/neg/macro-invalidusage-presuper.check index f63a0eef80..c0b1ec0248 100644 --- a/test/files/neg/macro-invalidusage-presuper.check +++ b/test/files/neg/macro-invalidusage-presuper.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: only type definitions and concrete field definitions allowed in early object initialization section +Macros_Test_2.scala:3: error: only concrete field definitions allowed in early object initialization section class D extends { def x = macro impl } with AnyRef ^ one error found diff --git a/test/files/neg/t2796.check b/test/files/neg/t2796.check index 4456a7fc19..22ee35a7e6 100644 --- a/test/files/neg/t2796.check +++ b/test/files/neg/t2796.check @@ -1,6 +1,9 @@ +t2796.scala:11: warning: early type members are deprecated. Move them to the regular body: the semantics are the same. + type X = Int // warn + ^ t2796.scala:7: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. val abstractVal = "T1.abstractVal" // warn ^ error: No warnings can be incurred under -Xfatal-warnings. -one warning found +two warnings found one error found diff --git a/test/files/neg/t2796.flags b/test/files/neg/t2796.flags index e8fb65d50c..d1b831ea87 100644 --- a/test/files/neg/t2796.flags +++ b/test/files/neg/t2796.flags @@ -1 +1 @@ --Xfatal-warnings \ No newline at end of file +-deprecation -Xfatal-warnings \ No newline at end of file diff --git a/test/files/neg/t2796.scala b/test/files/neg/t2796.scala index 3bcc9df562..fa2f2358b9 100644 --- a/test/files/neg/t2796.scala +++ b/test/files/neg/t2796.scala @@ -8,10 +8,9 @@ trait T1 extends { } with Base trait T2 extends { - type X = Int // okay + type X = Int // warn } with Base - class C1 extends { val abstractVal = "C1.abstractVal" // okay } with Base -- cgit v1.2.3