Community
Participate
Working Groups
It would be nice if the "common type inference" would derive Class<?> as the common type for multiple typeof expressions. E.g. the following Xtend2 snippet: test(Object a) { switch a { case null:typeof(Test) case a:typeof(Void) } } is compiled to: public Object test(final Object a) { Object _switchResult = null; final Object a_1 = a; boolean matched = false; if (!matched) { if (org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_equals(a_1,null)) { matched=true; _switchResult = Test.class; } } if (!matched) { if (org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_equals(a_1,a)) { matched=true; _switchResult = java.lang.Void.class; } } return _switchResult; } Note that the type inferred is Object and not Class<?>. The same can be observed with dispatch functions: dispatch foo(Void o) { typeof(Test) } dispatch foo(Integer o) { typeof(Integer) } results in: public Object _foo(final Void o) { return Test.class; } public Object _foo(final Integer o) { return java.lang.Integer.class; }
Pushed to master.
Closing all bugs that were set to RESOLVED before Neon.0