Ternary return not resolving correct type during edit
Issue #1886
resolved
The error shows Expected type String; found Boolean
and autocomplete doesn’t function. When line is completed (i.e. removing the String.
shown), it resolves fine
public class TimeDisplayController
{
public Time timeValue
{
get;
set;
}
public String getFormattedTime() {
return timeValue != null ? String. this.timeValue.hour() + ':' + this.timeValue.minute() : '???';
}
}
Comments (3)
-
repo owner -
repo owner - edited description
- removed version
-
repo owner - changed status to resolved
Delivered in 2.3.0.9.
- Log in to comment
Hah! You had me totally freaked out for just a minute when I thought you were showing me a new valid Apex syntax for
String.this
somewhat akin to how you qualify Java inner classthis
references as the outer class type. Then I realized what's really happening...I'll take a look. Might be a simple fix; might not. When code completion is happening the parser is put into a strange state with a dummy identifier at the point of completion. I'll have to see what that's doing to this ternary expression and whether/how I can detect it properly to provide the correct completions. I'm certain I can do it, but I just don't know how simple it will end up being.