Skip to content

Illegal flagset combination for Java Enums in sealedStrictDescendants #15908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jkciesluk opened this issue Aug 25, 2022 · 2 comments · Fixed by #19074
Closed

Illegal flagset combination for Java Enums in sealedStrictDescendants #15908

jkciesluk opened this issue Aug 25, 2022 · 2 comments · Fixed by #19074
Assignees

Comments

@jkciesluk
Copy link
Contributor

Compiler version

3.2.1-RC1-bin-20220816-cf4dd05-NIGHTLY

While using sealedStrictDescendants on Java enum symbol got

Aug 25, 2022 10:09:03 AM scala.meta.internal.pc.CompilerAccess handleError
SEVERE: assertion failed: illegal flagset combination: final <java> <static> enum <touched> and <children-queried>
java.lang.AssertionError: assertion failed: illegal flagset combination: final <java> <static> enum <touched> and <children-queried>
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.core.Flags$.$bar(Flags.scala:40)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.setFlag(SymDenotations.scala:81)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.children(SymDenotations.scala:1629)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.findLvl2$1(SymDenotations.scala:1666)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.sealedStrictDescendants(SymDenotations.scala:1687)
        at scala.meta.internal.pc.completions.CaseKeywordCompletion$.v$proxy1$1(MatchCaseCompletions.scala:218)
        at scala.meta.internal.pc.completions.CaseKeywordCompletion$.subclassesForType$1$$anonfun$1(MatchCaseCompletions.scala:218)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at scala.meta.internal.pc.completions.CaseKeywordCompletion$.subclassesForType$1(MatchCaseCompletions.scala:222)
        at scala.meta.internal.pc.completions.CaseKeywordCompletion$.matchContribute(MatchCaseCompletions.scala:228)
        at scala.meta.internal.pc.completions.Completions.advancedCompletions(Completions.scala:438)
        at scala.meta.internal.pc.completions.Completions.completions(Completions.scala:166)
        at scala.meta.internal.pc.completions.CompletionsProvider.completions(CompletionsProvider.scala:77)

Tested on java.nio.file.AccessMode
Using symbol.children instead works fine.

Expectation

Using symbol.sealedStrictDescendants on Java enum symbols should work the same as symbol.children.

@jkciesluk jkciesluk added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 25, 2022
@bishabosha
Copy link
Member

bishabosha commented Aug 25, 2022

could you try calling children on one of the member values of an enum, I think it should have the same effect

@jkciesluk
Copy link
Contributor Author

could you try calling children on one of the member values of an enum, I think it should have the same effect

it gives the exact same error

@Kordyjan Kordyjan added area:ide and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 25, 2022
bishabosha added a commit that referenced this issue Nov 28, 2023
…ASTy (#19074)

This PR contains the minimal forward incompatible changes of pipelining
- reading Java and outline symbols from TASTy.
The other changes to implement pipelining have no impact on TASTy or the
standard library - so can come in a patch release.

To test reading TASTy produced from Java defined classes, we add two
private flags `-Yjava-tasty` and `-Yjava-tasty-output`, which are not
expected to be used by any build tool. The tests allow us to write just
the java signatures to TASTy, package them in a jar, and then read the
Java TASTy from the classpath.

- Keep Java compilation units up to Pickler phase if `-Yjava-tasty` is
set. Skip phases for Java when not needed.
- Add `JAVAattr` and `OUTLINEattr` TASTy attributes, `ELIDED` tree tag.
`ELIDED` trees are pickled as rhs of java term definitions. `ELIDED`
trees can only be unpickled if `OUTLINEattr` is present.
- Java units will set the `JAVAattr` TASTy attribute. As currently we
outline parse Java files we also set the `OUTLINEattr`.
- In the future we might expand `OUTLINEattr` to include outline Scala
typing.
- `OUTLINEattr` and `JAVAattr` do not need any special flags to _read_
from the classpath, however to read outline tasty in the `-from-tasty`
mode (so `tasty-inspector` and `scaladoc` are included) we do require an
explicit `-Yallow-outline-from-tasty`, as method bodies are required for
full functionality.
- write java tasty files to a special jar, set with
`-Yjava-tasty-output`
  this option is for testing purposes only.

Fix sealedDescendants method for Java Enums.
- Rename `JavaEnumTrait` flags to `JavaEnum` (reflecting the actual
flags set)
- test java enum in `SealedDescendantsTest`

fixes #15908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants