diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-24 08:57:26 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-24 12:06:30 +0200 |
commit | 30099160320b649b1e8e5f69c8ad1b02478fbfe2 (patch) | |
tree | 9ab2e396c7a59379208e89fcc7324a5c4f21b65b /test/files/neg/t6771b.scala | |
parent | 4dcb33e6f527f5e2bf978c9e1ca778c40bf29d54 (diff) | |
download | scala-30099160320b649b1e8e5f69c8ad1b02478fbfe2.tar.gz scala-30099160320b649b1e8e5f69c8ad1b02478fbfe2.tar.bz2 scala-30099160320b649b1e8e5f69c8ad1b02478fbfe2.zip |
SI-6771 Alias awareness for checkableType in match analysis.
Failure to dealias the type of the scrutinee led the pattern
matcher to incorrectly reason about the type test in:
type Id[X] = X; (null: Id[Option[Int]]) match { case Some(_) => }
Before, `checkableType` returned `Id[?]`, now it returns `Some[?]`.
Diffstat (limited to 'test/files/neg/t6771b.scala')
-rw-r--r-- | test/files/neg/t6771b.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/files/neg/t6771b.scala b/test/files/neg/t6771b.scala new file mode 100644 index 0000000000..78f11f7750 --- /dev/null +++ b/test/files/neg/t6771b.scala @@ -0,0 +1,16 @@ +// Currently, the pattern matcher widens the type of the +// scrutinee, so this doesn't typecheck. This test just +// confirms this behaviour, although it would be an improvement +// to change this and make this a `pos` test. +// +// But, to the intrepid hacker who works on this, a few notes: +// You'll have to look into places in the pattern matcher that +// call `dealias`, and see if they need to be `dealiasWiden`. +// For example, if `checkableType` used only `dealias`, `pos/t6671.scala` +// would fail. +object Test { + val a = ""; var b: a.type = a + + b = b match { case x => x } +} + |