Community
Participate
Working Groups
There should be a warning if use generified types in type guards where the type erasured version is the same. val Object x = ... switch x { case List<String> : ... case List<Object> : ... } We should also apply all casting warnings here (i.e. the upper example would be at least an unsafe cast). Maybe we could generalize the rule such that if any type guard fetches all members of a subsequent type guard there should be an error/warning (because it is dead code). I.e. : val Object x = ... switch x { CharSequence : .... String : ... // error because all members are also of type CharSequence } If there is a regular guard this rule cannot be applied because we don't want to go into deep control flow analysis now (maybe later).
https://github.com/eclipse/xtext-xtend/issues/268
fixed in 2.13