@@ -367,17 +367,17 @@ TypeCheckBase::resolve_literal (const Analysis::NodeMapping &expr_mappings,
367367 tree capacity = Compile::HIRCompileBase::query_compile_const_expr (
368368 ctx, expected_ty, *literal_capacity);
369369
370- TyTy::ConstType *capacity_expr
371- = new TyTy::ConstType (TyTy::ConstType::ConstKind::Value, " " ,
372- expected_ty, capacity, {} ,
373- literal_capacity-> get_locus (),
374- literal_capacity->get_mappings (). get_hirid (),
375- literal_capacity-> get_mappings (). get_hirid (),
376- {});
377-
378- TyTy::ArrayType *array
379- = new TyTy::ArrayType (array_mapping. get_hirid (), locus ,
380- capacity_expr, TyTy::TyVar (u8 ->get_ref ()));
370+ HirId capacity_expr_id = literal_capacity-> get_mappings (). get_hirid ();
371+ auto capacity_expr
372+ = new TyTy::ConstValueType ( capacity, expected_ty, capacity_expr_id ,
373+ capacity_expr_id);
374+ context-> insert_type ( literal_capacity->get_mappings (),
375+ capacity_expr-> as_base_type ());
376+
377+ TyTy::ArrayType *array = new TyTy::ArrayType (
378+ array_mapping. get_hirid (), locus,
379+ TyTy::TyVar (capacity_expr-> as_base_type ()-> get_ty_ref ()) ,
380+ TyTy::TyVar (u8 ->get_ref ()));
381381 context->insert_type (array_mapping, array);
382382
383383 infered = new TyTy::ReferenceType (expr_mappings.get_hirid (),
@@ -597,22 +597,21 @@ TypeCheckBase::resolve_generic_params (
597597 = Compile::HIRCompileBase::query_compile_const_expr (
598598 ctx, specified_type, expr);
599599
600- TyTy::ConstType *default_const_decl
601- = new TyTy::ConstType (TyTy::ConstType::ConstKind::Value,
602- param.get_name (), specified_type,
603- default_value, {}, param.get_locus (),
604- expr.get_mappings ().get_hirid (),
605- expr.get_mappings ().get_hirid (), {});
600+ auto default_const_decl
601+ = new TyTy::ConstValueType (default_value, specified_type,
602+ expr.get_mappings ().get_hirid (),
603+ expr.get_mappings ().get_hirid (),
604+ {});
606605
607606 context->insert_type (expr.get_mappings (), default_const_decl);
608607 }
609608
610- TyTy::ConstType *const_decl
611- = new TyTy::ConstType (TyTy::ConstType::ConstKind::Decl ,
612- param. get_name (), specified_type,
613- error_mark_node, {}, param.get_locus (),
614- param.get_mappings ().get_hirid (),
615- param. get_mappings (). get_hirid (), {});
609+ TyTy::BaseGeneric *const_decl
610+ = new TyTy::ConstParamType (param. get_name (), param. get_locus () ,
611+ specified_type,
612+ param.get_mappings (). get_hirid (),
613+ param.get_mappings ().get_hirid (),
614+ {});
616615
617616 context->insert_type (generic_param->get_mappings (), const_decl);
618617 TyTy::SubstitutionParamMapping p (*generic_param, const_decl);
0 commit comments