Skip to content
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

Fix non-exhaustive warnings with the Ast.expr.Call node #227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mingun
Copy link
Contributor

@Mingun Mingun commented Dec 1, 2020

Because function pointers are forbidden in the expression language from now parser
won't allow anymore following constructions:

  • 42()
  • "string"()
  • true()
  • (...)()
  • []()

This PR fixes those warnings (3):

[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/GraphvizClassCompiler.scala:319:24: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
[warn] (Please try with scalac -Ypatmat-exhaust-depth 40 or -Ypatmat-exhaust-depth off.)
[warn]         val fromFunc = func match {
[warn]                        ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/GraphvizClassCompiler.scala:319:24: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
[warn] (Please try with scalac -Ypatmat-exhaust-depth 40 or -Ypatmat-exhaust-depth off.)
[warn]         val fromFunc = func match {
[warn]                        ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/translators/CommonMethods.scala:192:5: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
[warn] (Please try with scalac -Ypatmat-exhaust-depth 40 or -Ypatmat-exhaust-depth off.)
[warn]     func match {
[warn]     ^

Strangely, but it seems that some code are compiled twice, because you can notice identical warnings, for example GraphvizClassCompiler.scala:319:24.

Somehow it introduces 3 new warnings, but it seems that there have a limit on count of warnings from compiler (!?):

  • This warning is duplication of another warning:
    [warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/languages/RustCompiler.scala:142:17: unreachable code
    [warn]         out.puts(s"     stream: ${kaitaiType2NativeType(attrType)},")
    [warn]                 ^
    
  • That warnings seems to be new just because. I have no idea why they appeared, they seems unrelated to changes:
    [warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/translators/CppTranslator.scala:106:24: match may not be exhaustive.
    [warn] It would fail on the following input: SharedPointers
    [warn]       config.cppConfig.pointers match {
    [warn]                        ^
    [warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/translators/ExpressionValidator.scala:28:5: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
    [warn] (Please try with scalac -Ypatmat-exhaust-depth 40 or -Ypatmat-exhaust-depth off.)
    [warn]     v match {
    [warn]     ^
    

@Mingun
Copy link
Contributor Author

Mingun commented Mar 8, 2024

@GreyCat, @generalmimon, I see that you have some activity in the project recently. Could you find a time to review my PRs, for example, this?

@Mingun Mingun force-pushed the fix-warns-call-node branch 3 times, most recently from e3f7ced to d448244 Compare March 11, 2024 16:04
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Jul 7, 2024
Currently original KSC can parse more wider range of call expressions then it can handle,
actually it can handle only `[expr.]$name($args)` construction, but it can parse, for example:
- ()(args)
- [](args)
- 42(args)
- ""(args)
- true(args)

This is fixed in the original compiler in the kaitai-io/kaitai_struct_compiler#227
but it still not merged
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Jul 7, 2024
Currently original KSC can parse more wider range of call expressions then it can handle,
actually it can handle only `[expr.]$name($args)` construction, but it can parse, for example:
- ()(args)
- [](args)
- 42(args)
- ""(args)
- true(args)

This is fixed in the original compiler in the kaitai-io/kaitai_struct_compiler#227
but it still not merged
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Jul 13, 2024
Currently original KSC can parse more wider range of call expressions then it can handle,
actually it can handle only `[expr.]$name($args)` construction, but it can parse, for example:
- ()(args)
- [](args)
- 42(args)
- ""(args)
- true(args)

This is fixed in the original compiler in the kaitai-io/kaitai_struct_compiler#227
but it still not merged
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Jul 28, 2024
Currently original KSC can parse more wider range of call expressions then it can handle,
actually it can handle only `[expr.]$name($args)` construction, but it can parse, for example:
- ()(args)
- [](args)
- 42(args)
- ""(args)
- true(args)

This is fixed in the original compiler in the kaitai-io/kaitai_struct_compiler#227
but it still not merged
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Aug 8, 2024
Currently original KSC can parse more wider range of call expressions then it can handle,
actually it can handle only `[expr.]$name($args)` construction, but it can parse, for example:
- ()(args)
- [](args)
- 42(args)
- ""(args)
- true(args)

This is fixed in the original compiler in the kaitai-io/kaitai_struct_compiler#227
but it still not merged
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Aug 9, 2024
Currently original KSC can parse more wider range of call expressions then it can handle,
actually it can handle only `[expr.]$name($args)` construction, but it can parse, for example:
- ()(args)
- [](args)
- 42(args)
- ""(args)
- true(args)

This is fixed in the original compiler in the kaitai-io/kaitai_struct_compiler#227
but it still not merged
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Aug 14, 2024
Currently original KSC can parse more wider range of call expressions then it can handle,
actually it can handle only `[expr.]$name($args)` construction, but it can parse, for example:
- ()(args)
- [](args)
- 42(args)
- ""(args)
- true(args)

This is fixed in the original compiler in the kaitai-io/kaitai_struct_compiler#227
but it still not merged
Because function pointers is forbidden in the expression language from now parser
won't allow anymore following constructions:
- 42()
- "string"()
- true()
- (...)()
- []()

Fixes the warnings (3):
```
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/GraphvizClassCompiler.scala:319:24: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
[warn] (Please try with scalac -Ypatmat-exhaust-depth 40 or -Ypatmat-exhaust-depth off.)
[warn]         val fromFunc = func match {
[warn]                        ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/GraphvizClassCompiler.scala:319:24: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
[warn] (Please try with scalac -Ypatmat-exhaust-depth 40 or -Ypatmat-exhaust-depth off.)
[warn]         val fromFunc = func match {
[warn]                        ^
[warn] /home/runner/work/kaitai_struct_compiler/kaitai_struct_compiler/compiler/shared/src/main/scala/io/kaitai/struct/translators/CommonMethods.scala:192:5: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
[warn] (Please try with scalac -Ypatmat-exhaust-depth 40 or -Ypatmat-exhaust-depth off.)
[warn]     func match {
[warn]     ^
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant