[ nice-Bugs-866853 ] ?t20 incorrect return type

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

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Isaac Gouy (igouy)
Assigned to: Nobody/Anonymous (nobody)
Summary: ?t20 incorrect return type

Initial Comment:
Unsure if this is a bug or incorrect use.

interface ReadablePropertyMap <Key,Value>  {
  ?Value get(Key k);
}

class hash_property_map <A,B> 
implements ReadablePropertyMap <A,B> {

   HashMap<A,B> data = new HashMap();

   get(k) = data.get(k); // line 10 ***
}


\Nice\graph_test\..\graph_test\hash_property_map.nice:
 line 10, column 13:
Incorrect return type:
Found   : ?t20
Expected: ?Value

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

>Comment By: Daniel Bonniot (bonniot)
Date: 2004-01-17 17:01

Message:
Logged In: YES 
user_id=88952

Sorry for the wrong advice. At the moment, you should resort
to defining the method outside the class, and explain that
the result type is alwys an option type:

interface ReadablePropertyMap <Key,Value> {
  //?Value get(Key k);
}
<Key,Value,V | Value <: ?V> ?V
get(ReadablePropertyMap<Key,Value>, Key k);


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

Comment By: Isaac Gouy (igouy)
Date: 2003-12-29 14:37

Message:
Logged In: YES 
user_id=536291

That gives:
I:\pls\Nice\graph_test>nicec --sourcepath .. -a t.jar 
graph_test
nice.lang: parsing
graph_test: parsing

\Nice\graph_test\..\graph_test\hash_property_map.nice: line 
1, column 43:
Constraints on type parameters should all be specified in the 
prefix constraint

And this gives the ?t20 error again:
<Key,!Value> interface ReadablePropertyMap <Key,Value>  {
  ?Value get(Key k);
}


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

Comment By: Daniel Bonniot (bonniot)
Date: 2003-12-29 11:11

Message:
Logged In: YES 
user_id=88952

Same kind of issue. The treatment of marker on type variables 
will definitely need some polishing.

In this case I think the correct definition would be:

<Key,Value> interface ReadablePropertyMap <Key,!Value> {
?Value get(Key k);
}


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

Comment By: Isaac Gouy (igouy)
Date: 2003-12-29 01:41

Message:
Logged In: YES 
user_id=536291

Nice compiler version 0.9.6 prerelease (build 2003.12.28, 
21:41:54 UTC)

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

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


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
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.