Commit 8cc76114 authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur

(partial) bug fix, order of class definition and context in another class

parent 8bd791fb
......@@ -2,7 +2,7 @@ implementation module checktypes
import StdEnv
import syntax, checksupport, check, typesupport, utilities,
compilerSwitches //, RWSDebug
compilerSwitches // , RWSDebug
:: TypeSymbols =
......@@ -1306,7 +1306,6 @@ where
rec_type = makeAttributedType TA_Multi AN_Strict (TA type_symb [makeAttributedType TA_Multi AN_None TE \\ i <- [1..class_arity]])
field_type = makeAttributedType TA_Multi AN_None TE
(rev_fields, var_heap, symbol_table)
= build_fields 0 nr_of_members class_members rec_type field_type index_type index_selector [] var_heap symbol_table
(index_selector, rev_fields, rev_field_types, class_defs, modules, var_heap, symbol_table)
......@@ -1371,6 +1370,18 @@ where
# ({class_name, 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 AN_Strict (TA type_symb [makeAttributedType TA_Multi AN_None TE \\ i <- [1..class_arity]])
/* RWS FIXME ...
This is a patch for the case that the class has a context field which class
has not yet been seen. For example (note the order of definitions):
class C2 a | C1 a
class C1 a :: a
A proper solution would be to split this in two phases. For example
1) assign class indices
2) bind context fields
This should then also work across (dcl) module boundaries.
*/
field_type = if (ds_index == NoIndex) (makeAttributedType TA_Multi AN_Strict TE) field_type
// ... RWS
(field, var_heap, symbol_table) = build_field field_nr class_name.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
......
Markdown is supported
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