Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 90c1886

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Improve type checking of records.
Belonging to [master]: - #2439
1 parent 1a8d982 commit 90c1886

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Compiler/NFFrontEnd/NFInst.mo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,8 @@ protected
18341834
ComplexType cty;
18351835
algorithm
18361836
cty := match restriction
1837-
case Restriction.RECORD() then ComplexType.RECORD(node);
1837+
case Restriction.RECORD()
1838+
then ComplexType.RECORD(InstNode.classScope(InstNode.getDerivedNode(node)));
18381839
else ComplexType.CLASS();
18391840
end match;
18401841

Compiler/NFFrontEnd/NFRecord.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ protected
129129
algorithm
130130
// The node we get is usually a record instance, with applied modifiers and so on.
131131
// So the first thing we do is to create a "pure" instance of the record.
132-
node := Lookup.lookupLocalSimpleName(InstNode.name(node), InstNode.parentScope(node));
132+
node := Lookup.lookupLocalSimpleName(InstNode.name(node), InstNode.classScope(InstNode.parent(node)));
133133
node := Inst.instantiate(node);
134134
Inst.instExpressions(node);
135135

136136
// Collect the record fields.
137137
(inputs, locals) := collectRecordParams(node);
138138

139139
// Create the output record element, using the instance created above as both parent and type.
140-
out_comp := Component.TYPED_COMPONENT(node, Type.COMPLEX(node, ComplexType.RECORD(node)),
140+
out_comp := Component.UNTYPED_COMPONENT(node, listArray({}),
141141
Binding.UNBOUND(NONE()), Binding.UNBOUND(NONE()),
142142
NFComponent.OUTPUT_ATTR, NONE(), Absyn.dummyInfo);
143143
out_rec := InstNode.fromComponent("$out" + InstNode.name(node), out_comp, node);

0 commit comments

Comments
 (0)