diff options
author | Martin Odersky <odersky@gmail.com> | 2017-02-11 00:11:25 +1100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-04 13:29:38 +0200 |
commit | c245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0 (patch) | |
tree | 8a116622aacd162b206a9dfcacab5db74e3427e8 /tests | |
parent | 8f3c9a80cd464a962abeede37087ed52a6d9970a (diff) | |
download | dotty-c245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0.tar.gz dotty-c245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0.tar.bz2 dotty-c245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0.zip |
More fine-grained distinctions when flags are defined.
Flags like Trait are in fact not always defined when a symbol
is created. For symbols loaded from class files, this flag, and
some other is defined only once the classfile has been loaded.
But this happens in general before the symbol is completed.
We model this distinction by separating from the `FromStartFlags` set
a new set `AfterLoadFlags` and distinguishing between the two sets
in `SymDenotations#is`.
Test case is enum-Option.scala. This erroneously complained before
that `Enum` was not a trait.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run/enum-Option.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/run/enum-Option.scala b/tests/run/enum-Option.scala new file mode 100644 index 000000000..74e449daf --- /dev/null +++ b/tests/run/enum-Option.scala @@ -0,0 +1,16 @@ +enum class Option[+T] extends Serializable { + def isDefined: Boolean +} +object Option { + case Some(x: T) { + def isDefined = true + } + case None extends Option[Nothing] { + def isDefined = false + } +} + +object Test { + def main(args: Array[String]) = + assert(Some(None).isDefined) +} |