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

Commit 343d155

Browse files
perostOpenModelica-Hudson
authored andcommitted
Fix InstUtil.findUnboundVariableUse for _
- Fix findUnboundVariableUse so that it prints an error message if _ is used like a variable, instead of failing and confusing users who forget to fill in placeholders.
1 parent d5b7bc2 commit 343d155

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Compiler/FrontEnd/InstUtil.mo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8053,6 +8053,12 @@ algorithm
80538053
case (exp as DAE.SIZE(),arg) then (exp,false,arg);
80548054
case (exp as DAE.CALL(path=Absyn.IDENT("isPresent"), attr = DAE.CALL_ATTR(builtin = true)),arg)
80558055
then (exp,false,arg);
8056+
case (DAE.CREF(componentRef = DAE.WILD()), (_, info))
8057+
algorithm
8058+
// _ shouldn't be allowed to be used like a variable, but until that's
8059+
// enforced just give an error message here instead of just failing.
8060+
Error.addSourceMessage(Error.WARNING_DEF_USE, {"_"}, info);
8061+
then (inExp, true, inTpl);
80568062
case (exp as DAE.CREF(componentRef=cr),(unbound,info))
80578063
equation
80588064
b = listMember(ComponentReference.crefFirstIdent(cr),unbound);

0 commit comments

Comments
 (0)