diff options
author | johnvg | 2011-02-24 13:00:32 +0000 |
---|---|---|
committer | johnvg | 2011-02-24 13:00:32 +0000 |
commit | 55a77769a9a4be1b7ebb2af0b27e2e03b7238801 (patch) | |
tree | 7d97732506aeaeb784bf065f72cedde7224cc41f /frontend/checktypes.icl | |
parent | fix error message for not imported qualified ident (diff) |
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1858 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/checktypes.icl')
-rw-r--r-- | frontend/checktypes.icl | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/frontend/checktypes.icl b/frontend/checktypes.icl index 8256eaa..15a3c0e 100644 --- a/frontend/checktypes.icl +++ b/frontend/checktypes.icl @@ -1,8 +1,7 @@ implementation module checktypes import StdEnv -import syntax, checksupport, check, typesupport, utilities, - compilerSwitches // , RWSDebug +import syntax, checksupport, check, typesupport, utilities import genericsupport from explicitimports import search_qualified_ident,::NameSpaceN,TypeNameSpaceN,ClassNameSpaceN @@ -88,7 +87,7 @@ where STE_BoundTypeVariable bv=:{stv_attribute, stv_info_ptr} -> ({ tv & tv_info_ptr = stv_info_ptr}, stv_attribute, (ts, ti, cs)) _ - -> (tv, TA_Multi, (ts, ti, { cs & cs_error = checkError var_id "undefined" cs.cs_error })) + -> (tv, TA_Multi, (ts, ti, {cs & cs_error = checkError var_id "type variable undefined" cs.cs_error})) instance bindTypes [a] | bindTypes a where @@ -189,7 +188,7 @@ where # (type_vars, (_, ti_type_heaps, cs)) = addTypeVariablesToSymbolTable cRankTwoScope vars [] ti_type_heaps cs (type, _, (ts, ti, cs)) = bindTypes cti type (ts, {ti & ti_type_heaps = ti_type_heaps}, cs) cs_symbol_table = removeAttributedTypeVarsFromSymbolTable cRankTwoScope type_vars cs.cs_symbol_table - = (TFA type_vars type, TA_Multi, (ts, ti, { cs & cs_symbol_table = cs_symbol_table })) + = (TFA type_vars type, TA_Multi, (ts, ti, {cs & cs_symbol_table = cs_symbol_table})) bindTypes cti=:{cti_module_index,cti_type_index,cti_lhs_attribute} type=:(TQualifiedIdent module_id type_name types) (ts=:{ts_type_defs,ts_modules}, ti, cs) # (found,{decl_kind,decl_ident=type_ident,decl_index=type_index},cs) = search_qualified_ident module_id type_name TypeNameSpaceN cs @@ -257,8 +256,6 @@ addToAttributeEnviron (TA_RootVar attr_var) root_attr attr_env error addToAttributeEnviron _ _ attr_env error = (attr_env, checkError "inconsistent attribution of type definition" "" error) - - emptyIdent name :== { id_name = name, id_info = nilPtr } checkTypeDef :: !Index !Index !*TypeSymbols !*TypeInfo !*CheckState -> (!*TypeSymbols, !*TypeInfo, !*CheckState); @@ -288,10 +285,8 @@ where determine_root_attribute TA_Unique name attr_var_heap = (TA_Unique, [], attr_var_heap) - // check_rhs_of_TypeDef :: !CheckedTypeDef ![AttributeVar] !CurrentTypeInfo !(!*TypeSymbols, !*TypeInfo, !*CheckState) -> (!TypeRhs, !(!*TypeSymbols, !*TypeInfo, !*CheckState)) - // check_rhs_of_TypeDef {td_ident,td_arity,td_args,td_rhs = td_rhs=:AlgType conses} attr_vars cti=:{cti_module_index,cti_type_index,cti_lhs_attribute} ts_ti_cs # type_lhs = { at_attribute = cti_lhs_attribute, at_type = TA (MakeTypeSymbIdent { glob_object = cti_type_index, glob_module = cti_module_index } td_ident td_arity) @@ -602,8 +597,7 @@ where -> (TA_Multi, oti, { cs & cs_error = checkError var_ident "inconsistently attributed (5)" cs.cs_error }) check_var_attribute var_attr new_attr oti cs = (var_attr, oti, { cs & cs_error = checkError var_ident "inconsistently attributed (6)" cs.cs_error })// ---> (var_attr, new_attr) - - + determine_attribute var_ident DAK_Unique new_attr error = case new_attr of TA_Multi @@ -618,7 +612,6 @@ where = (TA_Multi, error) determine_attribute var_ident dem_attr new_attr error = (new_attr, error) - check_attribute var_ident dem_attr _ this_attr oti cs = (TA_Multi, oti, cs) @@ -1597,17 +1590,19 @@ where # ({class_ident, class_arity, class_dictionary = {ds_ident, ds_index}}, _, class_defs, modules) = getClassDef ds_index glob_module mod_index class_defs modules type_symb = MakeTypeSymbIdent { glob_object = ds_index, glob_module = glob_module } ds_ident class_arity field_type = makeAttributedType TA_Multi (TA type_symb [makeAttributedType TA_Multi TE \\ i <- [1..class_arity]]) - (field, var_heap, symbol_table) = build_field field_nr class_ident.id_name rec_type_index rec_type field_type next_selector_index var_heap symbol_table - = build_context_fields mod_index (inc field_nr) tcs rec_type rec_type_index (inc next_selector_index) [ field : rev_fields ] + (field, var_heap, symbol_table) + = build_field field_nr class_ident.id_name rec_type_index rec_type field_type next_selector_index var_heap symbol_table + = build_context_fields mod_index (inc field_nr) tcs rec_type rec_type_index (inc next_selector_index) [field : rev_fields] [field_type : rev_field_types] class_defs modules var_heap symbol_table - build_context_fields mod_index field_nr [{tc_class = TCGeneric {gtc_generic, gtc_kind}} :tcs] rec_type rec_type_index + build_context_fields mod_index field_nr [{tc_class = TCGeneric {gtc_generic,gtc_kind,gtc_generic_dict}} :tcs] rec_type rec_type_index next_selector_index rev_fields rev_field_types class_defs modules var_heap symbol_table // FIXME: We do not know the type before the generic phase. // The generic phase currently does not update the type. - # field_type = makeAttributedType TA_Multi TE + # field_type = {at_attribute = TA_Multi, at_type = TGenericFunctionInDictionary gtc_generic gtc_kind gtc_generic_dict} # class_ident = genericIdentToClassIdent gtc_generic.glob_object.ds_ident.id_name gtc_kind - # (field, var_heap, symbol_table) = build_field field_nr class_ident.id_name rec_type_index rec_type field_type next_selector_index var_heap symbol_table - = build_context_fields mod_index (inc field_nr) tcs rec_type rec_type_index (inc next_selector_index) [ field : rev_fields ] + # (field, var_heap, symbol_table) + = build_field field_nr class_ident.id_name rec_type_index rec_type field_type next_selector_index var_heap symbol_table + = build_context_fields mod_index (inc field_nr) tcs rec_type rec_type_index (inc next_selector_index) [field : rev_fields] [field_type : rev_field_types] class_defs modules var_heap symbol_table build_context_fields mod_index field_nr [] rec_type rec_type_index next_selector_index rev_fields rev_field_types class_defs modules var_heap symbol_table = (next_selector_index, rev_fields, rev_field_types , class_defs, modules, var_heap, symbol_table) @@ -1617,7 +1612,7 @@ where (sd_type_ptr, var_heap) = newPtr VI_Empty var_heap field_id = { id_name = field_name, id_info = id_info } sel_def = - { sd_ident = field_id + { sd_ident = field_id , sd_field = field_id , sd_type = { st_vars = [], st_args = [ rec_type ], st_args_strictness=Strict 1, st_result = field_type, st_arity = 1, st_context = [], st_attr_vars = [], st_attr_env = [] } |