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

"SourceForge.net" <[email protected]> Wed, 16 Jun 2004 04:38:09 -0700
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: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Isaac Gouy (igouy)
>Assigned to: Daniel Bonniot (bonniot)
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-06-16 13:38

Message:
Logged In: YES 
user_id=88952

This bug has been fixed. The next release of the compiler will
include this correction. In the mean time, I encourage you try
the development version. It contains a version of the compiler
that fixes the bug. Please try it and reopen the bug-report if
you find any problem with it.

To know how to get an install the development version of the
compiler that fixes this bug, please read
http://nice.sourceforge.net/cgi-bin/twiki/view/Dev/DevelopmentVersion

Note that the bug has first been fixed in the CVS version, and it
might take one or two hours until the development version
includes the fix.

Thanks again for your help by submiting this bug report. 

Daniel Bonniot


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

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


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND