diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-12 12:24:08 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-14 13:29:48 +0200 |
commit | 524c90d09f2fb4687b312f2c7597393978d50b6a (patch) | |
tree | 1badec2cf5d0cf4ce3769d69af225005b7bc550e /test/files/neg/t6323a.check | |
parent | 0eabb63c06f4041077860875c9ea71216adf4faa (diff) | |
download | scala-524c90d09f2fb4687b312f2c7597393978d50b6a.tar.gz scala-524c90d09f2fb4687b312f2c7597393978d50b6a.tar.bz2 scala-524c90d09f2fb4687b312f2c7597393978d50b6a.zip |
SI-6323 outlaws free types from TypeTag
Free types are no longer acceptable in normal type tags.
Like type parameters or abstract type members they don't map on any real type,
therefore I think this is a justified change.
The main reason for doing is this is to prohibit people from using `typeOf`
on local classes. Sure, the guard introduced in the previous commit will raise
runtime errors about that, but this commit provides static checking.
Those especially persistent might use `absTypeOf` and then try to play around
with the weak type it returns, but that's advanced usage scenario, and I don't
worry much about it.
Bottom line: `typeOf` should just work.
Things that work with additional effort should be explicitly marked as such.
Diffstat (limited to 'test/files/neg/t6323a.check')
-rw-r--r-- | test/files/neg/t6323a.check | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/files/neg/t6323a.check b/test/files/neg/t6323a.check new file mode 100644 index 0000000000..694c79ca5f --- /dev/null +++ b/test/files/neg/t6323a.check @@ -0,0 +1,9 @@ +t6323a.scala:11: `package`.this.materializeTypeTag[Test](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[Test] because:
+failed to typecheck the materialized tag:
+cannot create a TypeTag referring to local class Test.Test
+ val value = u.typeOf[Test]
+ ^
+t6323a.scala:11: error: No TypeTag available for Test
+ val value = u.typeOf[Test]
+ ^
+one error found
|