﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1786	Empty list pattern incorrectly used causes an endless loop	adabe588@…	Martin Sjölund	"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
}}}
"	defect	closed	normal	1.9.0	Frontend		fixed		
