﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5497	OMC accepting illegal edge operator and generating wrong code	Andreas Heuermann	somebody	"OMC accepts edge operator with a relation as input. The modelica reference [https://build.openmodelica.org/Documentation/ModelicaReference.Operators.%27edge()%27.html] states that edge should only accept boolean values.
Whe should generate a warning or an error.

The backend-DAE is also wrong. For the model 
{{{
model HystereseBug
  input Real u;
  output Real y;
equation
  when {u>1, u<-1} then
    y = if edge(u>u_max) then 1 else -1;
  end when;
end HystereseBug;
}}}
`edge(u>u_max)` gets expandet to `edge(u)>edge(u_max)` and that generates wrong code:
{{{
hystBug._y = if (hystBug.u and not pre(hystBug.u)) > (hystBug.u_max and not hystBug.u_max) then 1.0 else -1.0;
}}}

Suggested solution:
Add a warning from Frontend for these kind of edge usage.
Add a tmp variable and replace it in edge. Then everything in the backend should (hopefully) work with `edge(tmp)`."	defect	closed	high	2.0.0	Frontend	v1.14.0-dev-nightly	invalid	edge relation	
