- ast.ml: Added Nullable variant to field_ty; param.ty/method_sig.ret/method_decl.ret now use field_ty - parser.ml: Parse ? prefix for field types, return types, parameters - dump.ml: Render ?T in --dump-ast output - types.ml: New typechecker (Task 6) with nullable field-kind derivation (WO_K_NULLABLE=6) - dune: Added types module - Added golden test fixtures for nullable types and statement/expression parser - Added implementation plan doc
25 lines
540 B
Text
25 lines
540 B
Text
class Widget {
|
|
fn describe(mut active: Bool) -> Text {
|
|
if active {
|
|
let inner = Widget { active: false }
|
|
return "on-plain"
|
|
}
|
|
while active {
|
|
active = false
|
|
}
|
|
for part in active {
|
|
return "loop"
|
|
}
|
|
if (Widget { active: true }).active {
|
|
return "on-parenthesized"
|
|
}
|
|
if make(Widget { active: true }) {
|
|
return "on-call-arg"
|
|
}
|
|
if items[Widget { active: true }] {
|
|
return "on-index"
|
|
}
|
|
let w = Widget { active: true, label: "hello" }
|
|
return "off"
|
|
}
|
|
}
|