| Summary: | [xbase] [compiler] casting using function type literal produces illegal Java | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Knut Wannheden <knut.wannheden> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sebastian.zarnekow |
| Version: | 2.0.0 | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | M7 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Pushed to master. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
The following Xtend2 snippet: <T extends Integer> castOfFunction() { [T a,T b|(a+(b as Integer))] as (T,T)=>T } is accepted as legal by the Xtend2 editor, but is compiled to the following illegal Java code: public <T extends Integer> Function2<? extends Integer,? extends Integer,? extends Integer> castOfFunction() { final Function2<T,T,Integer> _function = new Function2<T,T,Integer>() { public Integer apply(T a , T b) { final T typeConverted_a = (T)a; int _operator_plus = IntegerExtensions.operator_plus(typeConverted_a, ((java.lang.Integer) b)); return _operator_plus; } }; return (((T, T) => T) _function); // COMPILE ERROR HERE }