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

Commit 659c567

Browse files
mahgeOpenModelica-Hudson
authored andcommitted
[NF] Minor fixs
- Fix wrong type for some discrete builtin functions. - Fix binding type matching decision. Belonging to [master]: - #2282
1 parent cc3ff32 commit 659c567

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Compiler/NFFrontEnd/NFCall.mo

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,7 @@ protected
14041404
if Type.isComplex(Type.arrayElementType(argty)) then
14051405
Type.COMPLEX(cls=recopnode) := argty;
14061406

1407+
// This will fail if it can't find the function.
14071408
fn_ref := Function.lookupFunctionSilent(Absyn.CREF_IDENT("'String'",{}), recopnode);
14081409
fn_ref := Function.instFuncRef(fn_ref, InstNode.info(recopnode));
14091410
candidates := Call.typeCachedFunctions(fn_ref);
@@ -1461,7 +1462,7 @@ protected
14611462
algorithm
14621463
argtycall := typeNormalCall(call, origin, info);
14631464
argtycall := matchTypedNormalCall(argtycall, origin, info);
1464-
ty := getType(call);
1465+
ty := getType(argtycall);
14651466
callExp := Expression.CALL(unboxArgs(argtycall));
14661467
end typeDiscreteCall;
14671468

@@ -1679,7 +1680,7 @@ protected
16791680

16801681
argtycall as ARG_TYPED_CALL(ComponentRef.CREF(node = fn_node), args, _) := typeNormalCall(call, origin, info);
16811682
argtycall := matchTypedNormalCall(argtycall, origin, info);
1682-
ty := getType(call);
1683+
ty := getType(argtycall);
16831684
callExp := Expression.CALL(unboxArgs(argtycall));
16841685

16851686
{arg} := args;

Compiler/NFFrontEnd/NFTypeCheck.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ algorithm
21342134

21352135
(exp, ty, ty_match) := matchTypes(binding.bindingType, comp_ty, binding.bindingExp, true);
21362136

2137-
if not isCompatibleMatch(ty_match) then
2137+
if not isValidBindingMatch(ty_match) then
21382138
Error.addSourceMessage(Error.VARIABLE_BINDING_TYPE_MISMATCH,
21392139
{name, Binding.toString(binding), Type.toString(comp_ty),
21402140
Type.toString(binding.bindingType)}, Binding.getInfo(binding));

0 commit comments

Comments
 (0)