@@ -152,17 +152,6 @@ static inline const ASR::symbol_t *symbol_get_past_external(const ASR::symbol_t
152152 }
153153}
154154
155- static inline ASR::ttype_t *type_get_past_const (ASR::ttype_t *f)
156- {
157- if (ASR::is_a<ASR::Const_t>(*f)) {
158- ASR::Const_t *e = ASR::down_cast<ASR::Const_t>(f);
159- LCOMPILERS_ASSERT (!ASR::is_a<ASR::Const_t>(*e->m_type ));
160- return e->m_type ;
161- } else {
162- return f;
163- }
164- }
165-
166155static inline ASR::ttype_t *type_get_past_pointer (ASR::ttype_t *f)
167156{
168157 if (ASR::is_a<ASR::Pointer_t>(*f)) {
@@ -227,9 +216,6 @@ static inline int extract_kind_from_ttype_t(const ASR::ttype_t* type) {
227216 case ASR::ttypeType::Allocatable: {
228217 return extract_kind_from_ttype_t (ASR::down_cast<ASR::Allocatable_t>(type)->m_type );
229218 }
230- case ASR::ttypeType::Const: {
231- return extract_kind_from_ttype_t (ASR::down_cast<ASR::Const_t>(type)->m_type );
232- }
233219 default : {
234220 return -1 ;
235221 }
@@ -277,10 +263,6 @@ static inline void set_kind_to_ttype_t(ASR::ttype_t* type, int kind) {
277263 set_kind_to_ttype_t (ASR::down_cast<ASR::Allocatable_t>(type)->m_type , kind);
278264 break ;
279265 }
280- case ASR::ttypeType::Const: {
281- set_kind_to_ttype_t (ASR::down_cast<ASR::Const_t>(type)->m_type , kind);
282- break ;
283- }
284266 default : {
285267 return ;
286268 }
@@ -392,10 +374,6 @@ static inline ASR::ttype_t* get_contained_type(ASR::ttype_t* asr_type, int overl
392374 ASR::Allocatable_t* pointer_asr = ASR::down_cast<ASR::Allocatable_t>(asr_type);
393375 return pointer_asr->m_type ;
394376 }
395- case ASR::ttypeType::Const: {
396- ASR::Const_t* const_asr = ASR::down_cast<ASR::Const_t>(asr_type);
397- return const_asr->m_type ;
398- }
399377 default : {
400378 return asr_type;
401379 }
@@ -602,10 +580,6 @@ static inline std::string type_to_str(const ASR::ttype_t *t)
602580 encode_dimensions (array_t ->n_dims , res, false );
603581 return res;
604582 }
605- case ASR::ttypeType::Const: {
606- return type_to_str (ASRUtils::get_contained_type (
607- const_cast <ASR::ttype_t *>(t))) + " const" ;
608- }
609583 case ASR::ttypeType::TypeParameter: {
610584 ASR::TypeParameter_t* tp = ASR::down_cast<ASR::TypeParameter_t>(t);
611585 return tp->m_param ;
@@ -660,10 +634,6 @@ static inline std::string type_to_str_with_substitution(const ASR::ttype_t *t,
660634 encode_dimensions (array_t ->n_dims , res, false );
661635 return res;
662636 }
663- case ASR::ttypeType::Const: {
664- return type_to_str_with_substitution (ASRUtils::get_contained_type (
665- const_cast <ASR::ttype_t *>(t)), subs) + " const" ;
666- }
667637 case ASR::ttypeType::FunctionType: {
668638 ASR::FunctionType_t* ftp = ASR::down_cast<ASR::FunctionType_t>(t);
669639 std::string result = " (" ;
@@ -1552,15 +1522,6 @@ static inline std::string get_type_code(const ASR::ttype_t *t, bool use_undersco
15521522 return " Allocatable[" + get_type_code (p->m_type , use_underscore_sep,
15531523 encode_dimensions_, set_dimensional_hint) + " ]" ;
15541524 }
1555- case ASR::ttypeType::Const: {
1556- ASR::Const_t* p = ASR::down_cast<ASR::Const_t>(t);
1557- if ( use_underscore_sep ) {
1558- return " Const_" + get_type_code (p->m_type , use_underscore_sep,
1559- encode_dimensions_, set_dimensional_hint) + " _" ;
1560- }
1561- return " Const[" + get_type_code (p->m_type , use_underscore_sep,
1562- encode_dimensions_, set_dimensional_hint) + " ]" ;
1563- }
15641525 case ASR::ttypeType::SymbolicExpression: {
15651526 return " S" ;
15661527 }
@@ -1694,10 +1655,6 @@ static inline std::string type_to_str_python(const ASR::ttype_t *t,
16941655 ASR::Allocatable_t* p = ASR::down_cast<ASR::Allocatable_t>(t);
16951656 return " Allocatable[" + type_to_str_python (p->m_type ) + " ]" ;
16961657 }
1697- case ASR::ttypeType::Const: {
1698- ASR::Const_t* p = ASR::down_cast<ASR::Const_t>(t);
1699- return " Const[" + type_to_str_python (p->m_type ) + " ]" ;
1700- }
17011658 case ASR::ttypeType::TypeParameter: {
17021659 ASR::TypeParameter_t *p = ASR::down_cast<ASR::TypeParameter_t>(t);
17031660 return p->m_param ;
@@ -2020,10 +1977,9 @@ static inline bool is_integer(ASR::ttype_t &x) {
20201977 // type_get_past_pointer(
20211978 // type_get_past_const(&x))))));
20221979 return ASR::is_a<ASR::Integer_t>(
2023- *type_get_past_const (
2024- type_get_past_array (
1980+ *type_get_past_array (
20251981 type_get_past_allocatable (
2026- type_get_past_pointer (&x))))) ;
1982+ type_get_past_pointer (&x))));
20271983}
20281984
20291985static inline bool is_unsigned_integer (ASR::ttype_t &x) {
@@ -2174,10 +2130,6 @@ inline size_t extract_dimensions_from_ttype(ASR::ttype_t *x,
21742130 n_dims = extract_dimensions_from_ttype (ASR::down_cast<ASR::Allocatable_t>(x)->m_type , m_dims);
21752131 break ;
21762132 }
2177- case ASR::ttypeType::Const: {
2178- n_dims = extract_dimensions_from_ttype (ASR::down_cast<ASR::Const_t>(x)->m_type , m_dims);
2179- break ;
2180- }
21812133 case ASR::ttypeType::SymbolicExpression:
21822134 case ASR::ttypeType::Integer:
21832135 case ASR::ttypeType::UnsignedInteger:
@@ -2476,9 +2428,6 @@ inline bool is_array(ASR::ttype_t *x) {
24762428}
24772429
24782430static inline bool is_aggregate_type (ASR::ttype_t * asr_type) {
2479- if ( ASR::is_a<ASR::Const_t>(*asr_type) ) {
2480- asr_type = ASR::down_cast<ASR::Const_t>(asr_type)->m_type ;
2481- }
24822431 return ASRUtils::is_array (asr_type) ||
24832432 !(ASR::is_a<ASR::Integer_t>(*asr_type) ||
24842433 ASR::is_a<ASR::UnsignedInteger_t>(*asr_type) ||
@@ -2581,12 +2530,6 @@ static inline ASR::ttype_t* duplicate_type(Allocator& al, const ASR::ttype_t* t,
25812530 ASR::CPtr_t* ptr = ASR::down_cast<ASR::CPtr_t>(t);
25822531 return ASRUtils::TYPE (ASR::make_CPtr_t (al, ptr->base .base .loc ));
25832532 }
2584- case ASR::ttypeType::Const: {
2585- ASR::Const_t* c = ASR::down_cast<ASR::Const_t>(t);
2586- ASR::ttype_t * dup_type = duplicate_type (al, c->m_type , dims);
2587- return ASRUtils::TYPE (ASR::make_Const_t (al, c->base .base .loc ,
2588- dup_type));
2589- }
25902533 case ASR::ttypeType::List: {
25912534 ASR::List_t* l = ASR::down_cast<ASR::List_t>(t);
25922535 ASR::ttype_t * dup_type = duplicate_type (al, l->m_type );
@@ -3442,11 +3385,6 @@ inline bool check_equal_type(ASR::ttype_t* x, ASR::ttype_t* y, bool check_for_di
34423385 x = ASRUtils::type_get_past_allocatable (x);
34433386 y = ASRUtils::type_get_past_allocatable (y);
34443387 return check_equal_type (x, y);
3445- } else if (ASR::is_a<ASR::Const_t>(*x) ||
3446- ASR::is_a<ASR::Const_t>(*y)) {
3447- x = ASRUtils::get_contained_type (x);
3448- y = ASRUtils::get_contained_type (y);
3449- return check_equal_type (x, y);
34503388 } else if (ASR::is_a<ASR::List_t>(*x) && ASR::is_a<ASR::List_t>(*y)) {
34513389 x = ASR::down_cast<ASR::List_t>(x)->m_type ;
34523390 y = ASR::down_cast<ASR::List_t>(y)->m_type ;
@@ -5189,9 +5127,9 @@ static inline void Call_t_body(Allocator& al, ASR::symbol_t* a_name,
51895127 }
51905128 if ( ASRUtils::is_array (arg_type) && ASRUtils::is_array (orig_arg_type) ) {
51915129 ASR::Array_t* arg_array_t = ASR::down_cast<ASR::Array_t>(
5192- ASRUtils::type_get_past_pointer (ASRUtils::type_get_past_const ( arg_type) ));
5130+ ASRUtils::type_get_past_pointer (arg_type));
51935131 ASR::Array_t* orig_arg_array_t = ASR::down_cast<ASR::Array_t>(
5194- ASRUtils::type_get_past_pointer (ASRUtils::type_get_past_const ( orig_arg_type) ));
5132+ ASRUtils::type_get_past_pointer (orig_arg_type));
51955133 if ( (arg_array_t ->m_physical_type != orig_arg_array_t ->m_physical_type ) ||
51965134 (arg_array_t ->m_physical_type == ASR::array_physical_typeType::DescriptorArray &&
51975135 arg_array_t ->m_physical_type == orig_arg_array_t ->m_physical_type &&
0 commit comments