Bug 413708 - [typesystem] Adding a closure parameter to a list removes upper bound
Summary: [typesystem] Adding a closure parameter to a list removes upper bound
Status: NEW
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.4.2   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: 2013-07-25 04:48 EDT by Jan Koehnlein CLA
Modified: 2013-07-25 04:48 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Koehnlein CLA 2013-07-25 04:48:01 EDT
Given a class Foo and an interface Bar

class Foo {}

interface Bar {
  def void bar() 
}

the following gives an error

class Bug {
  def <T extends Foo & Bar> onChange(List<? extends T> list) {
    list.forEach [
      val List<Foo> foos = null
      foos += it
      it.bar // ERROR: method bar undefined for type Bug
    ]
  }
}

The upper bound 'Bar' seems to be removed by adding 'it' to the list.
Switching the order of 'it.bar' and 'foos+=it' makes the error disappear