Enable source function type checks in the shared GUI runtime
Verify Tessera GUI / verify (push) Failing after 7m34s

This commit is contained in:
2026-10-21 22:40:11 +08:00
parent 6e69c5e5ce
commit 3a7b755532
7 changed files with 149 additions and 6 deletions
+20
View File
@@ -0,0 +1,20 @@
function identity(value: Number): Number { return value }
function callNumber(callback: Function): Number { return callback() }
function visual(value: Visual): Block { return value }
class Actions {
state: Object
function read(self: Actions): Number { return self.state.value }
function click(self: Actions, event: Event): Unit { self.state.increment() }
}
state = ui.state(0)
actions = Actions(state)
savedFunction = actions.read
initial = identity(callNumber(savedFunction))
button = Button("调用带类型检查的对象方法")
connection = button.on("click",actions.click)
root = visual(Column(24,16,TextBlock("源码、原生与绑定方法统一为 Function"),ui.textOf(state,"value"),button))
page = Page()
page.title = "函数类型检查"
page.render(root)
// identity("wrong") 会在进入函数体前报类型错误。
// callNumber(RectBlock) 会拒绝把类型构造器作为 Function。