1-layout/lower/rwir 按 kind 特化 - #8
Merged
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概览
实现 issue #6「1-layout/lower/rwir 按 kind 特化」:多态数值 op(add/+、eq/==、pow、sqrt、abs、min/max 等)在 layout 期按读参类型特化为
/lib/{kind}.{op}(如int64.add、float64.sqrt)。Closes #6
主要变更
kind 特化(#6)
rwir/builtin/num.go:registerKinds按 kind 集合批量注册 op,NumOp/IsNumKind/WiderNumKind/OpKind辅助lower/specialize.go:Specialize在 layout 期把多态 opcode 重写为{kind}.{op}rwir/builtin/{arith,bit,cmp,coerce,math}.go:改用registerKinds逐 kind 注册lower/infer.go:扩展类型推断(string./random./数学 op 返回类型、kvat/set 元素类型)parser/parser.go:移除num类型类(op 改为逐 kind 特化,不再靠num多态)layout/layout.go:WriteFunc调用lower.Specializestdlib/math.kv:移除 abs/sign/max/min rwfunc(下沉为 native 逐 kind op)rwir 命名空间
/rwir→/lib(相关 #5)keytree/{const,sys}.go:RwirRoot = LibRoot,rwir 签名与 rwfunc 同根/lib,靠 kind 区分工作流基建
.github/ISSUE_TEMPLATE/issue.md(issue 驱动模板)验证
go build ./...、go vet ./...通过🤖 Generated with Claude Code