parent
2ed72022ce
commit
9e0165147e
|
@ -1549,7 +1549,7 @@ static void preview_fn_proto(CodeGen *g, ImportTableEntry *import, AstNode *prot
|
|||
if (proto_node->data.fn_proto.generic_params.length > 0) {
|
||||
return preview_generic_fn_proto(g, import, proto_node);
|
||||
} else {
|
||||
return preview_fn_proto_instance(g, import, proto_node, import->block_context);
|
||||
return preview_fn_proto_instance(g, import, proto_node, proto_node->block_context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1572,9 +1572,11 @@ fn generic_struct() {
|
|||
var a1 = GenNode(i32) {.value = 13, .next = null,};
|
||||
var b1 = GenNode(bool) {.value = true, .next = null,};
|
||||
assert(a1.value == 13);
|
||||
assert(b1.value);
|
||||
assert(a1.value == a1.get_val());
|
||||
assert(b1.get_val());
|
||||
}
|
||||
struct GenNode(T: type) {
|
||||
value: T,
|
||||
next: ?&GenNode(T),
|
||||
fn get_val(n: &const GenNode(T)) -> T { n.value }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue