Conversation
Greptile SummaryThis PR moves
Confidence Score: 5/5Safe to merge — no failing tests or logic errors; findings are style-only. Both findings are P2: 'report mode is a verbosity/convention deviation that does not affect correctness, and the misleading comment does not break any test. All remaining concerns are minor style improvements. tests/liii/case-test.scm — check-set-mode! mode and the "单元素列表" comment at line 193. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["case* selector"] --> B{Pattern clause}
B -->|"literal atom\n(a b c)"| C["eqv? / equal? match\n→ result"]
B -->|"list pattern\n((p1 p2 ...))"| D{Element-wise match}
D -->|"#<label:>\nwildcard"| E["Capture value\n→ bind label"]
D -->|"#<pred?>\npredicate"| F["Apply predicate\n→ match if #t"]
D -->|"#<...>\nellipsis"| G["Consume remaining\nelements (0+)"]
E --> H["Result body\nreference via #<label>"]
F --> H
G --> H
C --> H
B -->|"else"| I["Default result"]
H --> J["Return value"]
I --> J
Reviews (1): Last reviewed commit: "wip" | Re-trigger Greptile |
| (liii case) | ||
| ) ;import | ||
|
|
||
| (check-set-mode! 'report) |
There was a problem hiding this comment.
tests/liii/ 下所有其他使用 check-set-mode! 的测试文件(例如 cut-test.scm)都设置 'report-failed。'report 会在每次运行时打印所有通过的测试用例,产生非常冗长的输出,不符合项目惯例。
| (check-set-mode! 'report) | |
| (check-set-mode! 'report-failed) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| ;; 单元素列表 | ||
| (check (case* '(only) | ||
| ((#<x:>) '#<x>) | ||
| (else 'none)) | ||
| => '(only)) |
There was a problem hiding this comment.
注释说明该测试匹配"单元素列表",但模式 (#<x:>) 中只有一层括号,在 case* 里这表示对任意值(包括列表、数字、符号等)进行通配捕获,而非专门匹配单元素列表。输入 '(only) 恰好是列表,x 被绑定到整个列表 (only),所以结果正确,但注释会误导读者。
若真正想演示匹配单元素列表,应使用双层括号 ((#<x:>)),与下面 list-info 中的模式一致:
;; 单元素列表 — 注意双括号,外层是子句括号,内层是列表模式
(check (case* '(only)
(((#<x:>)) '#<x>)
(else 'none))
=> 'only)
变更内容
case-test.scm从tests/goldfish/liii/移动到tests/liii/目录关联任务
216_49
🤖 Generated with Claude Code