Opened 12 years ago

Last modified 12 years ago

#1786 closed defect

Incorrectly pattern matching on a function pointer causes an endless loop of error messages — at Initial Version

Reported by: adabe588@… Owned by: somebody
Priority: normal Milestone: 1.9.0
Component: Frontend Version:
Keywords: Cc:

Description

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 (0)

Note: See TracTickets for help on using tickets.