Bug 454213 - [editor] Misleading highlighting / error marker
Summary: [editor] Misleading highlighting / error marker
Status: NEW
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.8.0   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-05 04:32 EST by Jan Koehnlein CLA
Modified: 2016-06-10 05:56 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Koehnlein CLA 2014-12-05 04:32:05 EST
class Foo {
  static def getDefault() {}
}

class Bar {
  def bar() {
    Foo.default  // default is italics and marked as an error
  }
}

The error is 'no viable alternative' because 'default' is recognized as a keyword so the parser fails. Nevertheless the type system seems to be able to resolve the static feature call such that semantic highlighting is applied. 

This is quite confusing. Unfortunately, it happens quite often as a static getDefault() method is common for activators and is used often on Display.

Workaround is of course to write ^default or getDefault.

Content assist will insert the latter.
Comment 1 Sebastian Zarnekow CLA 2014-12-05 04:51:08 EST
We should make 'default' a valid id and guide the parse with a predicate in the switch expression.

If this appears to be the only grammar change that we want to apply to Xbase, I'd be in favor of doing that only for Xtend.