eclipse / epsilon

Epsilon is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that work out of the box with EMF (including Xtext and Sirius), UML (including Cameo/MagicDraw), Simulink, XML and other types of models.
https://eclipse.org/epsilon
Eclipse Public License 2.0
53 stars 11 forks source link

ETL Special Assignment Operator semantics not respected by imported EOL scripts #53

Closed arcanefoam closed 9 months ago

arcanefoam commented 9 months ago

Description

When importing an EOL script into ETL, the Special Assignment Operator semantics are not respected when executing the code in the EOL script.

Example

// ETL
import "helper.eol"
rule AB
  transform a:A
  to b:B {
  b.ref = createC(a); 
} 
----

// helper.eol
operation createC(a:A) return C {
  var c = new C;
  c.other ::= a;
  return a;
}

Current Behavior

The statement c.other ::= a, will try to assign a to c.other, resulting in a cast error.

Expected Behavior The statement c.other ::= a, will assign a's equivalent to c.other.

kolovos commented 9 months ago

Thanks for reporting this Horacio. I've attached a minimal working example that demonstrates the issue.

kolovos commented 9 months ago

Until this gets fixed, you can use .equivalent() instead of ::= as a workaround, i.e. c.other = a.equivalent(); in your example.

kolovos commented 9 months ago

Fixed in https://github.com/eclipse/epsilon/commit/f5fc8db2d6c907b0875ef8f9e2b2a41a40a1c809.