[ nice-Bugs-1084559 ] exception in compiler

"SourceForge.net" <[email protected]> Wed, 05 Jan 2005 14:39:40 -0800
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #1084559, was opened at 2004-12-13 19:02
Message generated for change (Comment added) made by arjanb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1084559&group_id=12788

Category: None
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Bonniot (bonniot)
Summary: exception in compiler

Initial Comment:
hi,

while playing with the Nice compiler on JSDK 1.4.2_05,
Debian testing,
I get (for admittedly erroneous input(?))

$ PATH=/opt/nice-0.9.9/bin:${PATH} nicec --sourcepath
.. nice-test
nice.lang: parsing
nice-test: parsing

An exception has occured in the compiler
Please fill-in a bug report at the following webpage:
http://sourceforge.net/tracker/?func=add&group_id=12788&atid=112788

Stack trace:
Exception in thread "main" mlsub.typing.BadSizeEx: 1
expected, 0 given
        at
mlsub.typing.MonotypeConstructor.<init>(MonotypeConstructor.java:50)
        at
bossa.syntax.NiceMethod.create(NiceMethod.java:123)
        at
bossa.parser.Parser.internalMethodOrFunction(Parser.java:900)
        at
bossa.parser.Parser.classDefinition(Parser.java:1304)
        at bossa.parser.Parser.definition(Parser.java:2409)
        at
bossa.parser.Parser.readDefinitions(Parser.java:2446)
        at bossa.parser.Parser.module(Parser.java:3019)
        at
bossa.parser.JavaccParser.read(JavaccParser.java:70)
        at bossa.modules.Content.read(Content.java:111)
        at
bossa.modules.Content.getDefinitions(Content.java:86)
        at bossa.modules.Package.read(Package.java:121)
        at bossa.modules.Package.<init>(Package.java:87)
        at bossa.modules.Package.make(Package.java:58)
        at
bossa.modules.fun.setMainPackage(Compilation.nice:89)
        at
bossa.modules.Compilation.setMainPackage(Compilation.nice)
        at
nice.tools.compiler.fun.compile(interface.nice:38)
        at
bossa.modules.Compilation.compile(Compilation.nice)
        at
nice.tools.compiler.console.fun.compile(main.nice:165)
        at
nice.tools.compiler.console.dispatch.compile(dispatch.nice)
        at
nice.tools.compiler.console.fun.main(main.nice:181)
        at
nice.tools.compiler.console.dispatch.main(dispatch.nice)

$

The source is in part copied from the user's manual,
here it is.
regards, Georg [email protected]


interface Buffer<Elem>
{
  int size();

  boolean isFull();
  boolean isEmpty() ensures result == (size() == 0);

  void add(Elem element)
    requires
         !isfull() : "buffer must not be not full"  //
A comma here is optional
    ensures
         !isEmpty() : "buffer must not be empty",   //
Note the comma
         size() == old(size()) + 1 : "count inc";
}

class Aha extends Buffer<int> {

 String foo(int k)
   requires true;
 {
   Buffer<int> x = 0;
   
   return "";
 }
}


void main(String[] args) {
  println("Hello, " + foo(4));
}


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

>Comment By: Arjan Boeijink (arjanb)
Date: 2005-01-05 23:39

Message:
Logged In: YES 
user_id=688815

Fix is in development version.

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

Comment By: Daniel Bonniot (bonniot)
Date: 2004-12-18 03:46

Message:
Logged In: YES 
user_id=88952

This bug has been fixed in CVS.

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

Comment By: Arjan Boeijink (arjanb)
Date: 2004-12-14 01:37

Message:
Logged In: YES 
user_id=688815

This is a bug, the compiler doesn't handle subclasses with less 
type parameter as the superclass well.

As a workaround don't use typeparam fixing and write instead:
class Aha<Elem> extends Buffer<Elem> {



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

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


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt