Bug 419360 - Type mismatch when calling generic function directly
Summary: Type mismatch when calling generic function directly
Status: NEW
Alias: None
Product: Xtend
Classification: Tools
Component: Backlog (show other bugs)
Version: 2.4.3   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-14 08:57 EDT by Mark Fisher CLA
Modified: 2013-10-14 10:10 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Fisher CLA 2013-10-14 08:57:01 EDT
Unqualified invocation of a parametrised method fails unless it is the first line in a function body.

This code won't compile:
  .. any statement ..
  <Foo>bar() // two type mismatch errors occur.

  it.<Foo>bar() // compiles of course.

  ;<Foo>bar() // also compiles, unless first statement in body.

Won't compile:

  { ;<Foo>bar() }

  { ; }
Comment 1 Sven Efftinge CLA 2013-10-14 10:10:52 EDT
There are two things happening here:

1) Unlike Java Xtend doesn'T upport the empty statement (i.e. just a semicolon).
2) There is an ambiguity for an expression like

{
  foo
  <X>bar
}

as it is actually parsed as:

{
  foo<X>
  bar
}

Maybe we can support the empty expression.
For the second we could add a warning taking the whitespace into account.