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

Typechecker crashes on destructuring bind #2167

Open
PieterOlivier opened this issue Feb 28, 2025 · 0 comments
Open

Typechecker crashes on destructuring bind #2167

PieterOlivier opened this issue Feb 28, 2025 · 0 comments

Comments

@PieterOlivier
Copy link
Contributor

Describe the bug

Typechecker crashes on destructuring bind of adt

To Reproduce
Create the following module:

module sandbox::tcbug::CollectCrash

data X = xcon(int a);
void testBind() {
    X x = xcon(42);
    xcon(v) = x;
    println("v: <v>");
}

Trigger a typecheck by saving, the typechecker will crash.
The interpreter executes the code as expected.

Expected behavior
The typecheck succeeds.

Screenshots
Image

Stack traces

2025-02-28 11:34:28,252 [pool-3-thread-1] DEBUG - org.rascalmpl.vscode.lsp.rascal.RascalLanguageServices Running rascal check for: [|file:///d:/rascal/sandbox/src/main/rascal/sandbox/tcbug/CollectCrash.rsc|] with: srcs:      [|file:///d:/rascal/sandbox/src/main/rascal|]
ignores:   []
libs:      [|lib://rascal|]
bin:       |target://sandbox|
classpath: [|file:///C:/Users/pieter/.vscode/extensions/usethesource.rascalmpl-0.13.0-head1895/assets/jars/rascal-lsp.jar|,|file:///C:/Users/pieter/.vscode/extensions/usethesource.rascalmpl-0.13.0-head1895/assets/jars/rascal.jar|,|file:///C:/Users/pieter/.vscode/extensions/usethesource.rascalmpl-0.13.0-head1895/assets/jars/rascal-core.jar|,|file:///C:/Users/pieter/.vscode/extensions/usethesource.rascalmpl-0.13.0-head1895/assets/jars/typepal.jar|]
loaders:   [|target://sandbox|,|system:///|,|file:///C:/Users/pieter/.m2/repository/org/rascalmpl/rascal/0.33.8/rascal-0.33.8.jar|]

2025-02-28 11:34:28,302 [pool-2-thread-49] ERROR - org.rascalmpl.vscode.lsp.util.EvaluatorUtil Internal error during Rascal check
|lib://rascal-core/lang/rascalcore/check/CollectStatement.rsc|(25974,1,<599,66>,<599,67>): |lib://rascal-core/lang/rascalcore/check/CollectStatement.rsc|:599,66: CallFailed([
    appl(
      prod(
        label(
          "assignment",
          sort("Statement")),
        [
          label(
            "assignable",
            sort("Assignable")),
          layouts("LAYOUTLIST"),
          label(
            "operator",
            sort("Assignment")),
          layouts("LAYOUTLIST"),
          label(
            "statement",
            conditional(
              sort("Statement"),
              {
                except("variableDeclaration"),
                except("functionDeclaration")
              }))
        ],
        {tag("breakable"())}),
      [appl(
          prod(
            label(
              "constructor",
              sort("Assignable")),
            [
              label(
                "name",
                lex("Name")),
              layouts("LAYOUTLIST"),
              lit("("),
              layouts("LAYOUTLIST"),
              label(
                "arguments",
                \iter-seps(
                  sort("Assignable"),
                  [
                    layouts("LAYOUTLIST"),
                    lit(","),
                    layouts("LAYOUTLIST")
                  ])),
              layouts("LAYOUTLIST"),
              lit(")")
            ],
            {}),
          [appl(
              prod(
                lex("Name"),
                [conditional(
                    seq([
                        conditional(
                          \char-class([
                              range(65,90),
                              range(95,95),
                              range(97,122)
                            ]),
                          {\not-precede(\char-class([
                                  range(65,90),
                                  range(95,95),
                                  range(97,122)
                                ]))}),
                        conditional(
                          \iter-star(\char-class([
                                range(48,57),
                                range(65,90),
                                range(95,95),
                                range(97,122)
                              ])),
                          {\not-follow(\char-class([
                                  range(48,57),
                                  range(65,90),
                                  range(95,95),
                                  range(97,122)
                                ]))})
                      ]),
                    {delete(keywords("RascalKeywords"))})],
                {}),
              [appl(
                  regular(seq([
                        conditional(
                          \char-class([
                              range(65,90),
                              range(95,95),
                              range(97,122)
                            ]),
                          {\not-precede(\char-class([
                                  range(65,90),
                                  range(95,95),
                                  range(97,122)
                                ]))}),
                        conditional(
                          \iter-star(\char-class([
                                range(48,57),
                                range(65,90),
                                range(95,95),
                                range(97,122)
                              ])),
                          {\not-follow(\char-class([
                                  range(48,57),
                                  range(65,90),
                                  range(95,95),
                                  range(97,122)
                                ]))})
                      ])),
                  [char(120),appl(
                      regular(\iter-star(\char-class([
                              range(48,57),
                              range(65,90),
                              range(95,95),
                              range(97,122)
                            ]))),
                      [char(99),char(111),char(110)],
                      src=|file:///d:/rascal/sandbox/src/main/rascal/sandbox/tcbug/CollectCrash.rsc|(107,3,<6,5>,<6,8>))],
                  src=|file:///d:/rascal/sandbox/src/main/rascal/sandbox/tcbug/CollectCrash.rsc|(106,4,<6,4>,<6,8>))],
              src=|file:///d:/rascal/sandbox/src/main/rascal/sandbox/tcbug/CollectCrash.rsc|(106,4,<6,4>,<6,8>)),appl(
              prod(
                layouts("LAYOUTLIST"),
                [conditional(
                    \iter-star(lex("LAYOUT")),
                    {
                      \not-follow(\char-class([
                            range(9,13),
                            range(32,32),
                            range(133,133),
                            range(160,160),
                            range(5760,5760),
                            range(6158,6158),
                            range(8192,8202),
                            range(8232,8233),
                            range(8239,8239),
                            range(8287,8287),
                            range(12288,12288)
                          ])),
                      \not-follow(lit("//")),
                      \not-follow(lit("/*"))
                    })],
                {}),
              [appl(
                  regular(\iter-star(lex("LAY...
	at collect(|lib://rascal-core/lang/rascalcore/check/CollectStatement.rsc|(25912,65,<599,4>,<599,69>))
	at collectArgsN(|lib://typepal/analysis/typepal/Collector.rsc|(50283,20,<1238,8>,<1238,28>))
	at collect(|lib://typepal/analysis/typepal/Collector.rsc|(54333,77,<1334,12>,<1334,89>))
	at collect(|lib://rascal-core/lang/rascalcore/check/CollectDeclaration.rsc|(15631,23,<402,4>,<402,27>))
	at collect(|lib://rascal-core/lang/rascalcore/check/CollectDeclaration.rsc|(15234,22,<387,29>,<387,51>))
	at collectArgs2(|lib://typepal/analysis/typepal/Collector.rsc|(50062,20,<1228,8>,<1228,28>))
	at collect(|lib://typepal/analysis/typepal/Collector.rsc|(51561,22,<1282,29>,<1282,51>))
	at collect(|lib://typepal/analysis/typepal/Collector.rsc|(51156,109,<1276,36>,<1276,145>))
	at collect(|lib://rascal-core/lang/rascalcore/check/CollectDeclaration.rsc|(3605,33,<114,4>,<114,37>))
	at collectArgsN(|lib://typepal/analysis/typepal/Collector.rsc|(50283,20,<1238,8>,<1238,28>))
	at collect(|lib://typepal/analysis/typepal/Collector.rsc|(54333,77,<1334,12>,<1334,89>))
	at collectArgs2(|lib://typepal/analysis/typepal/Collector.rsc|(50062,20,<1228,8>,<1228,28>))
	at collect(|lib://typepal/analysis/typepal/Collector.rsc|(51561,22,<1282,29>,<1282,51>))
	at collect(|lib://typepal/analysis/typepal/Collector.rsc|(51156,109,<1276,36>,<1276,145>))
	at collect(|lib://typepal/analysis/typepal/Collector.rsc|(47989,15,<1136,4>,<1136,19>))
	at collect(|lib://rascal-core/lang/rascalcore/check/CollectDeclaration.rsc|(2013,25,<70,8>,<70,33>))
	at rascalTModelComponent(|lib://rascal-core/lang/rascalcore/check/Checker.rsc|(18821,27,<448,12>,<448,39>))
	at rascalTModelForLocs(|lib://rascal-core/lang/rascalcore/check/Checker.rsc|(9642,37,<253,27>,<253,64>))
	at check(|lib://rascal-core/lang/rascalcore/check/Checker.rsc|(22262,64,<547,9>,<547,73>))
	at $shell$(|main://$shell$|)

Version info

  • rascal version 0.41.0-RC13
  • rascal-core version 0.12.16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant