False error: @StateSet on a nested class gives "Argument Mismatch Error: ... expected Inner, got Inner"
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with TypeChecker.createStateGhost, then follow how GhostFunction and Utils handle the nested-class name Outer$Inner; Expression.throwArgumentMismatchError explains the reported type mismatch. Reproduce using the issue's Java example and compare with the top-level Inner case; done when the nested-class example verifies with “Correct! Passed Verification.”
由索引模型根据 Issue 内容生成。
描述
Impact: typestates on a nested class cannot be used: every state refinement of it fails with a self-contradictory message (expected Inner, got Inner) and no source location. The same class at top level verifies.
Minimal reproducer
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;
public class Outer {
@StateSet({"fresh", "ready"})
static class Inner {
@StateRefinement(to = "ready(this)")
public Inner() {}
@StateRefinement(from = "ready(this)", to = "fresh(this)")
public void use() {}
}
static void ok() {
Inner i = new Inner();
i.use();
}
}
Expected: Correct! Passed Verification., as for the same Inner as a top-level class.
Actual (main @ 0053074e; this is the whole output, with no code snippet):
Argument Mismatch Error: Argument '#this_1' and its respective parameter of ghost 'Outer$Inner.state1' types are incompatible: expected Inner, got Inner
Cause. TypeChecker.createStateGhost gives the stateN ghost the parameter type type.getSimpleName() (Inner). GhostFunction swaps that for the prefix only when it equals Utils.getSimpleName(prefix), which splits on . only, so for Outer$Inner it is Outer$Inner and the swap does not happen. The parameter type stays an unresolved reference to Inner, which is neither equal to nor a supertype of Outer$Inner in Expression.throwArgumentMismatchError; both print as Inner. Related: the $ vs . naming of nested classes also breaks @Ghost on them (Z3 sort mismatch, #467).
🤖 Generated with Claude Code
- 主要语言
- Java
- 星标
- 71
- 派生
- 37
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 46
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
liquid-java/liquidjava 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
liquid-java/liquidjava#443 ·
维护者通常 2 天内回复
-
bug real-world-finding
难度 2/5 1-3 小时 新手友好度 82/100
liquid-java/liquidjava#395 ·
维护者通常 2 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 65/100
liquid-java/liquidjava#373 ·
维护者通常 2 天内回复
-
bug error messages
难度 4/5 3-5 天 新手友好度 52/100
liquid-java/liquidjava#471 ·
维护者通常 2 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 69/100
liquid-java/liquidjava#470 ·
维护者通常 2 天内回复
查看 liquid-java/liquidjava 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
Dans-Plugins/Medieval-Roleplay-Engine#396 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 6 天内回复
-
type: dependency-upgrade
难度 1/5 1 小时以内 新手友好度 70/100
spring-projects/spring-session#4156 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
quarkiverse/quarkus-langchain4j#3127 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
HotswapProjects/HotswapAgent#688 ·