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

[K-Bug] “Cannot define constructor: sort has domain values” #3460

Closed
1 of 6 tasks
jeanas opened this issue Jun 11, 2023 · 4 comments · Fixed by #3615
Closed
1 of 6 tasks

[K-Bug] “Cannot define constructor: sort has domain values” #3460

jeanas opened this issue Jun 11, 2023 · 4 comments · Fixed by #3615
Assignees

Comments

@jeanas
Copy link

jeanas commented Jun 11, 2023

What component is the issue in?

haskell-backend

Which command

  • kompile
  • kast
  • krun
  • kprove
  • kprovex
  • ksearch

What K Version?

5.6.90

Operating System

Linux

K Definitions (If Possible)

module BUG-SYNTAX
  import ID-SYNTAX
endmodule

module BUG
  imports BUG-SYNTAX
  syntax Id ::= Foo(Id)
endmodule

Steps to Reproduce

$ kompile --backend haskell bug.k
kore-exec: [39759] Error (ErrorVerify):
    Error:
      module 'BUG':
      symbol 'LblFoo'LParUndsRParUnds'BUG'Unds'Id'Unds'Id' declaration (definition.kore 93:10):
        Cannot define constructor LblFoo'LParUndsRParUnds'BUG'Unds'Id'Unds'Id for sort SortId{}: sort has domain values.
Created bug report: kore-exec.tar.gz
[Error] Critical: Haskell backend reported errors validating compiled
definition.
Examine output to see errors.

Note that this is probably a legitimate error, but the error message seems to be asking me to report a bug.

It might be that the error should have been caught earlier.

This does not occur in the LLVM backend. I don't know if that's expected.

Expected Results

Either no error, or a proper error message instead of an internal error.

@radumereuta
Copy link
Contributor

You are correct. The haskell backend complains that you are extending a token sort with a constructor.
If you write syntax Id ::= Foo(Id) [function], then it's going to kompile just fine.

We need to add a check in the front end. Maybe here:
https://github.com/runtimeverification/k/blob/master/kernel/src/main/java/org/kframework/kompile/Kompile.java#L421

h0nzZik pushed a commit to h0nzZik/k that referenced this issue Jun 19, 2023
…untimeverification#3122)

* haskell-backend/src/main/native/haskell-backend: 31277dfa5 - Fix strictness bug in definedness check (runtimeverification#3457)

* Sync flake inputs to submodules

* haskell-backend/src/main/native/haskell-backend: 4354413a2 - Update dependency: deps/k_release (runtimeverification#3452)

* Sync flake inputs to submodules

* haskell-backend/src/main/native/haskell-backend: 142466333 - Fix output of debug rewrite rules (runtimeverification#3428) (runtimeverification#3456)

* Sync flake inputs to submodules

* haskell-backend/src/main/native/haskell-backend: 08f413c69 - Moving average timeouts (runtimeverification#3471)

* Sync flake inputs to submodules

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

* Sync flake inputs to submodules

---------

Co-authored-by: rv-jenkins <devops@runtimeverification.com>
@radumereuta radumereuta removed their assignment Aug 22, 2023
@gtrepta
Copy link
Contributor

gtrepta commented Aug 28, 2023

Why is this ok on the llvm backend but not the haskell backend? Should token sorts be allowed to have non-function productions?

@Robertorosmaninho
Copy link
Collaborator

From @dwightguth: It shouldn't be allowed in llvm-backend as well. It should be blocked by the frontend.

@Robertorosmaninho Robertorosmaninho self-assigned this Sep 1, 2023
@Robertorosmaninho
Copy link
Collaborator

The problem here is that we identify and print the sort that must contain domain values here. But this information isn't available easily in any part of the code.

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 a pull request may close this issue.

4 participants