[ nice-Bugs-825290 ] instanceof type inference fails for A<T>

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #825290, was opened at 2003-10-17 06:30
Message generated for change (Comment added) made by bonniot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=825290&group_id=12788

Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Rohan Hart (dr_dee)
>Assigned to: Daniel Bonniot (bonniot)
Summary: instanceof type inference fails for A<T>

Initial Comment:
package A;

class A<T> {}
class B<T> extends A<T> {
  T t;
}

void f() {
  A<String> a = ff(new B(t: "hi").t);
  while (a instanceof B) {
    a = ff(a.t);  // error on this line for a.t
  }
}

A<String> ff(String s) = new B(t: s);

----
Arguments (A.B<A.A<java.lang.String>>) do not fit: 
T A.B.t


----------------------------------------------------------------------

>Comment By: Daniel Bonniot (bonniot)
Date: 2003-10-17 12:37

Message:
Logged In: YES 
user_id=88952

Right, dynamic type inference was wrong for parameterized
types. This is now fixed in CVS and dev version.

A simpler testcase was:
class A<T> {}
class B<T> extends A<T> {
  T t;
}

void f() {
  A<String> a = new B(t: "hi");
  if (a instanceof B) {
    String s = a.t;
  }
}


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=825290&group_id=12788


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.