Opened 13 years ago
Closed 13 years ago
#1786 closed defect (fixed)
Empty list pattern incorrectly used causes an endless loop
| Reported by: | Owned by: | Martin Sjölund | |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.9.0 |
| Component: | Frontend | Version: | |
| Keywords: | Cc: |
Description (last modified by )
This causes infinite loop of error messages when trying to match a function against {}.
Should halt at the first type error.
If debug flags aren't present it loops silently.
package PatternMatchInvalidType
partial function Nothing
end Nothing;
function nothing
algorithm
end nothing;
public function test1
input Nothing n;
algorithm
_ := match(n)
case ({}) then ();
else fail();
end match;
end test1;
public function test
algorithm
test1(nothing);
end test;
end PatternMatchInvalidType;
setCommandLineOptions({"+d=rml,noevalfunc,failtrace","+g=MetaModelica","+showAnnotations","+showErrorMessages"});
loadFile("PatternMatchInvalidType.mo");
getErrorString();
// Result:
// true
// ""
// endResult
PatternMatchInvalidType.test();
getErrorString();
{true,true,true,true}
true
""
- Static.elabCrefSubs failed on: <Prefix.NOPRE()>.nothing env: PatternMatchInvalidType.test
{"[PatternMatchInvalidType.mo:14:10-14:15:writable] Error: Type mismatch in pattern {}
actual type:
list<#T_UNKNOWN#>
expected type:
.PatternMatchInvalidType.Nothing<function>() => #NORETCALL#", "TRANSLATION", "Error", "5022"}
{"[PatternMatchInvalidType.mo:14:10-14:15:writable] Error: Type mismatch in pattern {}
actual type:
list<#T_UNKNOWN#>
expected type:
.PatternMatchInvalidType.Nothing<function>() => #NORETCALL#", "TRANSLATION", "Error", "5022"}
{"[PatternMatchInvalidType.mo:14:10-14:15:writable] Error: Type mismatch in pattern {}
actual type:
list<#T_UNKNOWN#>
... and so on
Change History (2)
comment:1 by , 13 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 13 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
| Summary: | Incorrectly pattern matching on a function pointer causes an endless loop of error messages → Empty list pattern incorrectly used causes an endless loop |
Note:
See TracTickets
for help on using tickets.

Fixed in r12688.