diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-04 11:21:54 +0200 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-10-04 11:21:54 +0200 |
commit | c1492ac08e69e64e258ee9c5a0e5173165f4cba1 (patch) | |
tree | 11b155006310ca98617f8294388cc5052b16c66f | |
parent | 192d65f718ab042cb57090d580c83e15a0509964 (diff) | |
parent | 0d8ca1f5fe335565f861ce2c58f7f684f15a4064 (diff) | |
download | scala-c1492ac08e69e64e258ee9c5a0e5173165f4cba1.tar.gz scala-c1492ac08e69e64e258ee9c5a0e5173165f4cba1.tar.bz2 scala-c1492ac08e69e64e258ee9c5a0e5173165f4cba1.zip |
Merge pull request #4024 from retronym/ticket/8217
SI-8217 allow abstract type members in objects
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 1 | ||||
-rw-r--r-- | test/files/neg/t3240.check | 4 | ||||
-rw-r--r-- | test/files/neg/t8217-local-alias-requires-rhs.check | 10 | ||||
-rw-r--r-- | test/files/neg/t8217-local-alias-requires-rhs.scala | 15 | ||||
-rw-r--r-- | test/files/neg/t845.check | 4 | ||||
-rw-r--r-- | test/files/pos/t3240.scala (renamed from test/files/neg/t3240.scala) | 0 | ||||
-rw-r--r-- | test/files/pos/t845.scala (renamed from test/files/neg/t845.scala) | 0 |
7 files changed, 26 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index fdff2f3076..e876d4a6af 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1643,6 +1643,7 @@ trait Namers extends MethodSynthesis { def symbolAllowsDeferred = ( sym.isValueParameter || sym.isTypeParameterOrSkolem + || (sym.isAbstractType && sym.owner.isClass) || context.tree.isInstanceOf[ExistentialTypeTree] ) // Does the symbol owner require no undefined members? diff --git a/test/files/neg/t3240.check b/test/files/neg/t3240.check deleted file mode 100644 index efae682c66..0000000000 --- a/test/files/neg/t3240.check +++ /dev/null @@ -1,4 +0,0 @@ -t3240.scala:3: error: only classes can have declared but undefined members - type t - ^ -one error found diff --git a/test/files/neg/t8217-local-alias-requires-rhs.check b/test/files/neg/t8217-local-alias-requires-rhs.check new file mode 100644 index 0000000000..0d4f0864ba --- /dev/null +++ b/test/files/neg/t8217-local-alias-requires-rhs.check @@ -0,0 +1,10 @@ +t8217-local-alias-requires-rhs.scala:6: error: only classes can have declared but undefined members + type B + ^ +t8217-local-alias-requires-rhs.scala:3: error: only classes can have declared but undefined members + type A + ^ +t8217-local-alias-requires-rhs.scala:14: error: only classes can have declared but undefined members + def this(a: Any) = { this(); type C } + ^ +three errors found diff --git a/test/files/neg/t8217-local-alias-requires-rhs.scala b/test/files/neg/t8217-local-alias-requires-rhs.scala new file mode 100644 index 0000000000..12b7976835 --- /dev/null +++ b/test/files/neg/t8217-local-alias-requires-rhs.scala @@ -0,0 +1,15 @@ +trait Alias { + def foo = { + type A + } + val bar = { + type B + object O { + type OK + } + } +} + +class C { + def this(a: Any) = { this(); type C } +} diff --git a/test/files/neg/t845.check b/test/files/neg/t845.check deleted file mode 100644 index 07ed7e417b..0000000000 --- a/test/files/neg/t845.check +++ /dev/null @@ -1,4 +0,0 @@ -t845.scala:4: error: only classes can have declared but undefined members - type Bar; - ^ -one error found diff --git a/test/files/neg/t3240.scala b/test/files/pos/t3240.scala index cf197a406d..cf197a406d 100644 --- a/test/files/neg/t3240.scala +++ b/test/files/pos/t3240.scala diff --git a/test/files/neg/t845.scala b/test/files/pos/t845.scala index ddf6a16f32..ddf6a16f32 100644 --- a/test/files/neg/t845.scala +++ b/test/files/pos/t845.scala |