Skip to content
New issue

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

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

Already on GitHub? # to your account

[Bug] [kompile] - Uncaught exception thrown of type AssertionError #2461

Closed
yanliu18 opened this issue Mar 2, 2022 · 2 comments · Fixed by #2641
Closed

[Bug] [kompile] - Uncaught exception thrown of type AssertionError #2461

yanliu18 opened this issue Mar 2, 2022 · 2 comments · Fixed by #2641
Assignees
Labels

Comments

@yanliu18
Copy link
Contributor

yanliu18 commented Mar 2, 2022

K Version

K version:    v5.2.95-0-gaa5eee670-dirty
Build date:   Tue Mar 01 00:15:37 AEDT 2022

Description

Internal: Uncaught exception thrown of type AssertionError
(AssertionError: null)

Input Files

File name:
stmt.k

module LESSON-16-A-SYNTAX
  imports INT-SYNTAX
  imports ID-SYNTAX

  syntax Exp ::= Id | Int
  syntax Decl ::= "int" Id "=" Exp ";" [strict(2)] 
  syntax Pgm ::= List{Decl,""}
endmodule

module STMT
    imports LESSON-16-A-SYNTAX
    imports BOOL

    syntax Stmt ::= Id "=" Exp ";" [strict(2)]
    syntax Pgm ::= List{Stmt, ""} 

    configuration <T>
                  <k> $PGM:Pgm </k>
                  <state> .Map </state>
                </T>

  // declaration sequence
  rule <k> S:Stmt; P:Pgm => S ~> P ...</k>
  rule <k> .Pgm => . ...</k>

  // variable declaration
  rule <k> X:Id = I:Int ; => . ...</k>
       <state> STATE => STATE [ X <- I ] </state>

  // variable lookup
  rule <k> X:Id => I ...</k>
       <state>... X |-> I ...</state>

  syntax Bool ::= isKResult(K) [symbol, function]
  rule isKResult(_:Int) => true
  rule isKResult(_) => false [owise]
endmodule

Reproduction Steps

kompile --debug stmt.k

bug report:

java.lang.AssertionError
	at org.kframework.definition.UserList.getLists(UserList.java:48)
	at org.kframework.parser.inner.generator.RuleGrammarGenerator.getCombinedGrammarImpl(RuleGrammarGenerator.java:473)
	at org.kframework.parser.inner.ParseInModule.getParsingModule(ParseInModule.java:122)
	at org.kframework.parser.inner.kernel.Scanner.<init>(Scanner.java:56)
	at org.kframework.parser.inner.ParseInModule.getScanner(ParseInModule.java:183)
	at org.kframework.kompile.DefinitionParsing.lambda$resolveConfigBubbles$17(DefinitionParsing.java:323)
	at scala.collection.parallel.AugmentedIterableIterator.map2combiner(RemainsIterator.scala:116)
	at scala.collection.parallel.AugmentedIterableIterator.map2combiner$(RemainsIterator.scala:113)
	at scala.collection.parallel.immutable.ParHashSet$ParHashSetIterator.map2combiner(ParHashSet.scala:81)
	at scala.collection.parallel.ParIterableLike$Map.leaf(ParIterableLike.scala:1064)
	at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67)
	at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56)
	at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50)
	at scala.collection.parallel.ParIterableLike$Map.tryLeaf(ParIterableLike.scala:1061)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:153)
	at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute$(Tasks.scala:149)
	at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440)
	at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
[Error] Internal: Uncaught exception thrown of type AssertionError
(AssertionError: null)
@yanliu18 yanliu18 added the bug label Mar 2, 2022
@Baltoli
Copy link
Contributor

Baltoli commented Mar 2, 2022

The problem here is that you're trying to declare the Pgm sort as two different syntactic lists. Internally, we desugar Lists like this (taken from the K source code):

    // find all productions annotated with 'userList'
    // expecting to always find 2 of them of the form:
    // Es ::= E "," Es  [right, userList, klabel(...)]
    // Es ::= ".Es"     [userList, klabel(...)]

which will only work for a single list production per sort.

I agree that this could do with a nicer error message than the assertion failure you're seeing.

@ehildenb
Copy link
Member

ehildenb commented Mar 3, 2022

kompile should print out a nice structured error that points out both locations.

@radumereuta radumereuta self-assigned this Jun 6, 2022
h0nzZik pushed a commit to h0nzZik/k that referenced this issue Nov 24, 2022
…untimeverification#1830)

* haskell-backend/src/main/native/haskell-backend: 79703e11 - Update dependency: deps/k_release

* haskell-backend/src/main/native/haskell-backend: 8428df45 - LTS Haskell 17.4

* haskell-backend/src/main/native/haskell-backend: 2e714c56 - Add an EquationVariableName to RewritingVariableName

* haskell-backend/src/main/native/haskell-backend: c5cc46be - Update dependency: deps/k_release

* haskell-backend/src/main/native/haskell-backend: 0c4ad203 - Update dependency: deps/k_release

* haskell-backend/src/main/native/haskell-backend: a182994f - Update dependency: deps/k_release

* haskell-backend/src/main/native/haskell-backend: 9460590a - Simplify side conditions (runtimeverification#2393)

* haskell-backend/src/main/native/haskell-backend: 4fb83523 - Fix `variable` to `RewritingVariableName` in `Kore.Equation.Application` (runtimeverification#2325)

* haskell-backend/src/main/native/haskell-backend: f41cba23 - Revert "Revert runtimeverification#2315 (runtimeverification#2385)" (runtimeverification#2389)

* haskell-backend/src/main/native/haskell-backend: 44eed8d7 - Run Test workflow on macOS (runtimeverification#2420)

* haskell-backend/src/main/native/haskell-backend: 904f5322 - kore-repl: Print human-readable error messages (runtimeverification#2441)

* haskell-backend/src/main/native/haskell-backend: b49fdd3c - Make Conditional's term a strict field (runtimeverification#2442)

* haskell-backend/src/main/native/haskell-backend: 01f0402d - adding match for And (runtimeverification#2435)

* haskell-backend/src/main/native/haskell-backend: 3243d1e5 - kore-0.41.0.0 (runtimeverification#2444)

* haskell-backend/src/main/native/haskell-backend: 28913344 - Update dependency: deps/k_release

* haskell-backend/src/main/native/haskell-backend: abf0292b - Use unit and element symbol attributes

* haskell-backend/src/main/native/haskell-backend: 7d3ee1bc - Inefficient Equation renaming (runtimeverification#2438)

* haskell-backend/src/main/native/haskell-backend: 95b6c107 - Stop simplifying the left-hand side of equations (runtimeverification#2392)

* haskell-backend/src/main/native/haskell-backend: 21959d95 - Add instructions for running one test in Docker (runtimeverification#2456)

* haskell-backend/src/main/native/haskell-backend: 4195d948 - Removes sort checks for Map and Set during internalization (runtimeverification#2440)

* Predicates in the condition are now simplified

* haskell-backend/src/main/native/haskell-backend: c35bfa56 - Remove defined marker (runtimeverification#2380)

* haskell-backend/src/main/native/haskell-backend: 57ad3292 - Remove cabal.project.freeze (runtimeverification#2450)

* haskell-backend/src/main/native/haskell-backend: 66158c67 - Support the --bug-report and --no-bug-report options in kore-repl (#2462)

* haskell-backend/src/main/native/haskell-backend: f0d93ac5 - Use stderr for errors (runtimeverification#2458)

* haskell-backend/src/main/native/haskell-backend: 0427fae7 - Distinguish \bottom from stuck states (runtimeverification#2451)

* haskell-backend/src/main/native/haskell-backend: d136446e - Fix Strict performance (runtimeverification#2447)

* haskell-backend/src/main/native/haskell-backend: a4e55b2a - Remove IMP fragment tests (runtimeverification#2467)

* haskell-backend/src/main/native/haskell-backend: 1f61e5a6 - Revert PRs related to InternalAc, Unit, Element & Concat symbols changes (runtimeverification#2463)

* haskell-backend/src/main/native/haskell-backend: fcfc2d52 - Remove the EvaluatedF marker from TermLike (runtimeverification#2469)

* haskell-backend/src/main/native/haskell-backend: fb56d719 - Revert PR runtimeverification#2334 (runtimeverification#2473)

* haskell-backend/src/main/native/haskell-backend: bb258f14 - Add ref = "main"; to default.nix (runtimeverification#2475)

* haskell-backend/src/main/native/haskell-backend: 964e64e7 - Update dependency: deps/k_release (runtimeverification#2464)

* haskell-backend/src/main/native/haskell-backend: abf14770 - Emit a warning when kore-exec exceeds the depth limit (runtimeverification#2461)

* haskell-backend/src/main/native/haskell-backend: 003a8424 - Update dependency: deps/k_release (runtimeverification#2478)

* haskell-backend/src/main/native/haskell-backend: 485bd89a - kore-0.42.0.0 (runtimeverification#2477)

* Add definedness to lookup rules, regenerate tests

* haskell-backend/src/main/native/haskell-backend: 78515d10 - Update dependency: deps/k_release (runtimeverification#2486)

* Revert changes to domains.md and test output

* haskell-backend/src/main/native/haskell-backend: 4f3a751c - Format code with fourmolu (runtimeverification#2382)

* haskell-backend/src/main/native/haskell-backend: de80594b - Update dependency: deps/k_release (runtimeverification#2490)

* Update map symbolic Haskell tests

* haskell-backend/src/main/native/haskell-backend: 9c9ef914 - Update dependency: deps/k_release (runtimeverification#2495)

Co-authored-by: ana-pantilie <ana.pantilie95@gmail.com>
Co-authored-by: Thomas Tuegel <thomas.tuegel@runtimeverification.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants