Commit 14bef518 authored by John van Groningen's avatar John van Groningen
Browse files

refactor, rename type OverloadedListType as OverloadedPatternType

parent 799a382e
......@@ -1257,7 +1257,7 @@ where
# name_expr = makeStringExpr name
= buildPredefConsApp PD_CGenTypeCons [name_expr] predefs heaps
make_unboxed_list :: !*ExpressionHeap !PredefinedSymbols -> (!OverloadedListType,!Expression,!*ExpressionHeap)
make_unboxed_list :: !*ExpressionHeap !PredefinedSymbols -> (!OverloadedPatternType,!Expression,!*ExpressionHeap)
make_unboxed_list expr_heap predef_symbols
# stdStrictLists_index = predef_symbols.[PD_StdStrictLists].pds_def
nil_u_index = predef_symbols.[PD_nil_u].pds_def
......@@ -1269,7 +1269,7 @@ make_unboxed_list expr_heap predef_symbols
unboxed_list = UnboxedList stdStrictLists_index decons_u_index nil_u_index
= (unboxed_list,decons_expr,expr_heap)
make_unboxed_tail_strict_list :: !*ExpressionHeap !PredefinedSymbols -> (!OverloadedListType,!Expression,!*ExpressionHeap)
make_unboxed_tail_strict_list :: !*ExpressionHeap !PredefinedSymbols -> (!OverloadedPatternType,!Expression,!*ExpressionHeap)
make_unboxed_tail_strict_list expr_heap predef_symbols
# stdStrictLists_index = predef_symbols.[PD_StdStrictLists].pds_def
nil_uts_index = predef_symbols.[PD_nil_uts].pds_def
......@@ -1281,7 +1281,7 @@ make_unboxed_tail_strict_list expr_heap predef_symbols
unboxed_list = UnboxedTailStrictList stdStrictLists_index decons_uts_index nil_uts_index
= (unboxed_list,decons_expr,expr_heap)
make_unboxed_maybe :: !*ExpressionHeap !PredefinedSymbols -> (!OverloadedListType,!Expression,!*ExpressionHeap)
make_unboxed_maybe :: !*ExpressionHeap !PredefinedSymbols -> (!OverloadedPatternType,!Expression,!*ExpressionHeap)
make_unboxed_maybe expr_heap predef_symbols
# stdStrictMaybes_index = predef_symbols.[PD_StdStrictMaybes].pds_def
nothing_u_index = predef_symbols.[PD_nothing_u].pds_def
......
......@@ -1447,16 +1447,17 @@ cIsNotStrict :== False
| BasicPatterns !BasicType [BasicPattern]
| NewTypePatterns !GlobalIndex ![AlgebraicPattern]
| DynamicPatterns [DynamicPattern] /* auxiliary */
| OverloadedListPatterns !OverloadedListType !Expression ![AlgebraicPattern]
| OverloadedListPatterns !OverloadedPatternType !Expression ![AlgebraicPattern]
| NoPattern /* auxiliary */
:: OverloadedListType = UnboxedList !Index !Index !Index // StdStrictLists module index, decons_u index, nil_u index
| UnboxedTailStrictList !Index !Index !Index // StdStrictLists module index, decons_uts index, nil_uts index
| OverloadedList !Index !Index !Index // StdStrictLists module index, decons index, nil index
| OverloadedMaybe !Index !Index !Index // StdStrictMaybes module index, from_just index, nothing index
| UnboxedMaybe !Index !Index !Index // StdStrictMaybes module index, from_just_u index, nothing_u index
:: OverloadedPatternType
= UnboxedList !Index !Index !Index // StdStrictLists module index, decons_u index, nil_u index
| UnboxedTailStrictList !Index !Index !Index // StdStrictLists module index, decons_uts index, nil_uts index
| OverloadedList !Index !Index !Index // StdStrictLists module index, decons index, nil index
| OverloadedMaybe !Index !Index !Index // StdStrictMaybes module index, from_just index, nothing index
| UnboxedMaybe !Index !Index !Index // StdStrictMaybes module index, from_just_u index, nothing_u index
instance == OverloadedListType
instance == OverloadedPatternType
:: Selection = RecordSelection !(Global DefinedSymbol) !Int
| ArraySelection !(Global DefinedSymbol) !ExprInfoPtr !Expression
......
......@@ -1018,7 +1018,7 @@ instance == Annotation
where
(==) a1 a2 = equal_constructor a1 a2
instance == OverloadedListType
instance == OverloadedPatternType
where
(==) a1 a2 = equal_constructor a1 a2
......
......@@ -1042,16 +1042,16 @@ fresh_overloaded_maybe_type [{ap_symbol}:patterns] pd_just_symbol pd_nothing_sym
# argument_types = [tst_result]
= (argument_types,result_type,tst_context,tst_attr_env,ts)
freshOverloadedListType :: !OverloadedListType !CoercionPosition ![AlgebraicPattern] !{#CommonDefs} !{#{#FunType }} !*TypeState -> (![[AType]],!AType,![TypeContext],![AttrCoercion],!*TypeState)
freshOverloadedListType (UnboxedList stdStrictLists_index decons_u_index nil_u_index) pos patterns common_defs functions ts
freshOverloadedPatternType :: !OverloadedPatternType !CoercionPosition ![AlgebraicPattern] !{#CommonDefs} !{#{#FunType }} !*TypeState -> (![[AType]],!AType,![TypeContext],![AttrCoercion],!*TypeState)
freshOverloadedPatternType (UnboxedList stdStrictLists_index decons_u_index nil_u_index) pos patterns common_defs functions ts
= fresh_overloaded_list_type patterns PD_UnboxedConsSymbol PD_UnboxedNilSymbol decons_u_index nil_u_index stdStrictLists_index pos functions common_defs ts
freshOverloadedListType (UnboxedTailStrictList stdStrictLists_index decons_u_index nil_u_index) pos patterns common_defs functions ts
freshOverloadedPatternType (UnboxedTailStrictList stdStrictLists_index decons_u_index nil_u_index) pos patterns common_defs functions ts
= fresh_overloaded_list_type patterns PD_UnboxedTailStrictConsSymbol PD_UnboxedTailStrictNilSymbol decons_u_index nil_u_index stdStrictLists_index pos functions common_defs ts
freshOverloadedListType (OverloadedList stdStrictLists_index decons_u_index nil_u_index) pos patterns common_defs functions ts
freshOverloadedPatternType (OverloadedList stdStrictLists_index decons_u_index nil_u_index) pos patterns common_defs functions ts
= fresh_overloaded_list_type patterns PD_OverloadedConsSymbol PD_OverloadedNilSymbol decons_u_index nil_u_index stdStrictLists_index pos functions common_defs ts
freshOverloadedListType (UnboxedMaybe stdStrictMaybes_index from_just_u_index nothing_u_index) pos patterns common_defs functions ts
freshOverloadedPatternType (UnboxedMaybe stdStrictMaybes_index from_just_u_index nothing_u_index) pos patterns common_defs functions ts
= fresh_overloaded_maybe_type patterns PD_UnboxedJustSymbol PD_UnboxedNothingSymbol from_just_u_index nothing_u_index stdStrictMaybes_index pos functions common_defs ts
freshOverloadedListType (OverloadedMaybe stdStrictMaybes_index from_just_index nothing_index) pos patterns common_defs functions ts
freshOverloadedPatternType (OverloadedMaybe stdStrictMaybes_index from_just_index nothing_index) pos patterns common_defs functions ts
= fresh_overloaded_maybe_type patterns PD_OverloadedJustSymbol PD_OverloadedNothingSymbol from_just_index nothing_index stdStrictMaybes_index pos functions common_defs ts
cWithFreshContextVars :== True
......@@ -1841,8 +1841,8 @@ where
requirements_of_guarded_expressions (OverloadedListPatterns alg_type decons_expr=:(App {app_symb,app_info_ptr}) patterns) match_expr case_info_ptr ti=:{ti_common_defs,ti_functions} pattern_type opt_pattern_ptr goal_type reqs ts
# (position, ts_var_heap) = getPositionOfExpr match_expr ts.ts_var_heap
# ts = {ts & ts_var_heap = ts_var_heap}
# (cons_types, result_type, context, new_attr_env, ts) = freshOverloadedListType alg_type position patterns ti_common_defs ti_functions ts
ts & ts_var_heap = ts_var_heap
(cons_types, result_type, context, new_attr_env, ts) = freshOverloadedPatternType alg_type position patterns ti_common_defs ti_functions ts
(used_cons_types, (reqs, ts)) = requirements_of_algebraic_patterns ti patterns cons_types goal_type [] (reqs, ts)
ts_expr_heap = storeAttribute opt_pattern_ptr result_type.at_attribute ts.ts_expr_heap
type_coercions = [{tc_demanded = result_type,tc_offered = pattern_type, tc_position = position,tc_coercible = True} : reqs.req_type_coercions]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment