[K-Bug] `#let`, `#as`, and `#fun` break type safety
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- compilers
Research direction
Start by running kompile on the three reproductions: test-let.k, test-as.k, and test-fun.k. Trace the front-end type checking for #let, #as, and #fun, using the shown outputs as the expected behavior. Done means each invalid use reports a type error instead of compiling with only a warning or no diagnostic.
Written by the indexing model from the issue text.
Description
What component is the issue in?
Front-End
Which command
- kompile
- kast
- krun
- kprove
- kprovex
- ksearch
What K Version?
v6.0.137
Operating System
Linux
K Definitions (If Possible)
test-let.k
module TEST-LET
syntax Void
syntax Foo ::= foo()
syntax Top ::= start()
| Evil(Void)
rule start() => #let X = foo() #in Evil(X)
endmodule
test-as.k
module TEST-AS
syntax Void
syntax Top ::= start()
| Evil(Void)
rule start() #as X => Evil(X)
endmodule
test-fun.k
module TEST-FUN
syntax Void
syntax Foo ::= foo()
syntax Top ::= start()
| Evil(Void)
rule start() => #fun(X => Evil(X))(foo())
endmodule
Steps to Reproduce
kompile test-let.k --main-module TEST-LET --syntax-module TEST-LET- Output:
[Warning] Compiler: Non exhaustive match detected: `#lambda__`(_)
- Output:
kompile test-as.k --main-module TEST-AS --syntax-module TEST-AS- Output:
- Output:
kompile test-fun.k --main-module TEST-FUN --syntax-module TEST-FUN- Output:
[Warning] Compiler: Non exhaustive match detected: `#lambda__`(_)
- Output:
Expected Results
We should report a type error in all cases.
test-let.k
[Error] Inner Parser: Unexpected sort Foo for variable X. Expected: Void
Source(test-let.k)
Location(7,41,7,42)
7 | rule start() => #let X = foo() #in Evil(X)
. ^
[Error] Compiler: Had 1 parsing errors.
test-as.k
[Error] Inner Parser: Unexpected sort Top for variable X. Expected: Void
Source(test-as.k)
Location(6,28,6,29)
6 | rule start() #as X => Evil(X)
. ^
[Error] Compiler: Had 1 parsing errors.
test-fun.k
[Error] Inner Parser: Unexpected sort Foo for term parsed as production syntax
Foo ::= "foo" "(" ")" [klabel(foo)]. Expected: Void
Source(test-let.k)
Location(7,36,7,41)
7 | rule start() => #fun(X => Evil(X))(foo())
. ^~~~~
[Error] Compiler: Had 1 parsing errors.
- Dominant language
- Python
- Stars
- 591
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from runtimeverification/k
-
runtimeverification/k#4939 · 1 assignee ·
-
Concolic Explorer Open
Difficulty 5/5 Over a week Newbie friendliness 32/100
runtimeverification/k#4937 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
runtimeverification/k#4936 ·
-
type:epic
runtimeverification/k#4934 · 4 comments · 1 assignee ·
-
runtimeverification/k#4924 · 1 assignee ·
All issues in runtimeverification/k
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100