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 Mingun force-pushed the fix-warns-call-node branch from 95adee9 to 3f66677 Compare December 21, 2020 09:44
@Mingun Mingun force-pushed the fix-warns-call-node branch from 3f66677 to b41de90 Compare May 12, 2021 15:53
@Mingun Mingun force-pushed the fix-warns-call-node branch from b41de90 to 6667717 Compare August 25, 2021 08:09
@Mingun Mingun force-pushed the fix-warns-call-node branch from 6667717 to efb528c Compare April 10, 2023 16:00
@Mingun Mingun force-pushed the fix-warns-call-node branch from efb528c to 299ee3a Compare September 12, 2023 14:14
@Mingun Mingun force-pushed the fix-warns-call-node branch 2 times, most recently from 1fd61b1 to 5c13cf7 Compare October 24, 2023 15:28
@Mingun Mingun force-pushed the fix-warns-call-node branch from 5c13cf7 to ea3fcf0 Compare March 8, 2024 06:06
@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 Mingun force-pushed the fix-warns-call-node branch from d448244 to 9a303bd Compare April 6, 2024 12:03
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 Mingun force-pushed the fix-warns-call-node branch from 9a303bd to a0914b4 Compare July 13, 2024 15:54
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 Mingun force-pushed the fix-warns-call-node branch from a0914b4 to db77b64 Compare July 16, 2024 14:22
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]     ^
```
@Mingun Mingun force-pushed the fix-warns-call-node branch from db77b64 to 307b76b Compare September 8, 2024 04:53
Mingun added a commit to Mingun/ksc-rs that referenced this pull request Oct 6, 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
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