Fix losing type pointer in constant type value
This commit is contained in:
@@ -50,7 +50,7 @@ MakeArray :: (a: *int, count: int): Array(int)
|
|||||||
MultipleArgs :: (): Tuple(int, F32)
|
MultipleArgs :: (): Tuple(int, F32)
|
||||||
return {32, 32}
|
return {32, 32}
|
||||||
|
|
||||||
PolyLambda :: ($T: Type): T
|
PolyLambda :: ($T: Type = *int): T
|
||||||
return 32
|
return 32
|
||||||
|
|
||||||
GetCount :: (a: int): int
|
GetCount :: (a: int): int
|
||||||
@@ -71,7 +71,10 @@ main :: (argc: int, argv: **char): int
|
|||||||
fifth: Array(F32)
|
fifth: Array(F32)
|
||||||
sixth: Array(Array(F32))
|
sixth: Array(Array(F32))
|
||||||
seventh: Variant(int, F32, S64)
|
seventh: Variant(int, F32, S64)
|
||||||
// d: int(32)
|
|
||||||
|
test_a := int
|
||||||
|
test := *int
|
||||||
|
Assert(test_a != test)
|
||||||
|
|
||||||
// c := MakeArray(buff, GetCount(GetCount(32)))
|
// c := MakeArray(buff, GetCount(GetCount(32)))
|
||||||
|
|
||||||
@@ -85,6 +88,6 @@ main :: (argc: int, argv: **char): int
|
|||||||
Test(10, b = 10, c = 20)
|
Test(10, b = 10, c = 20)
|
||||||
Test(a = 10, b = 10, c = 20)
|
Test(a = 10, b = 10, c = 20)
|
||||||
|
|
||||||
value := PolyLambda(int)
|
value := PolyLambda(**int)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@@ -260,7 +260,7 @@ Ast *ast_copy(Ast *ast, Ast_Scope *parent_scope, Array<Ast_Decl *> *replace, Arr
|
|||||||
|
|
||||||
dst->args.init(pctx->perm, src->args.len);
|
dst->args.init(pctx->perm, src->args.len);
|
||||||
For(src->args) {
|
For(src->args) {
|
||||||
if (it->flags & AST_POLYMORPH) continue;
|
if (it->flags & AST_IDENT_POLYMORPH) continue;
|
||||||
auto copy = (Ast_Decl *)ast_copy(it, parent_scope, replace, with);
|
auto copy = (Ast_Decl *)ast_copy(it, parent_scope, replace, with);
|
||||||
dst->args.add(copy);
|
dst->args.add(copy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1408,11 +1408,12 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str
|
|||||||
return operand_lvalue_set_flag_on_node(node->resolved_type, node);
|
return operand_lvalue_set_flag_on_node(node->resolved_type, node);
|
||||||
}
|
}
|
||||||
else if (value.type->kind == TYPE_TYPE) {
|
else if (value.type->kind == TYPE_TYPE) {
|
||||||
|
value.type_val = type_pointer(value.type_val);
|
||||||
if (!is_flag_set(flags, RESOLVE_TYPESPEC)) {
|
if (!is_flag_set(flags, RESOLVE_TYPESPEC)) {
|
||||||
rewrite_into_const(node, Ast_Array, value.value);
|
rewrite_into_const(node, Ast_Unary, value.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
node->resolved_type = type_pointer(value.type_val);
|
node->resolved_type = value.type_val;
|
||||||
return operand_type(node->resolved_type);
|
return operand_type(node->resolved_type);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user