nullness in assignments

Artem Gr <[email protected]> Tue, 1 Mar 2005 12:21:56 +0300
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
I'm trying to implement the RFE# 681385.
Have currently the following:

Index: typecheck.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v
retrieving revision 1.125
diff -u -r1.125 typecheck.nice
--- typecheck.nice      22 Feb 2005 10:26:42 -0000      1.125
+++ typecheck.nice      1 Mar 2005 09:15:35 -0000
@@ -50,7 +50,25 @@
   
   try{
     e.value = e.value.resolveOverloading(to.getType());
+    // jdb -classpath classes nice.tools.testsuite.TestNice testsuite\compiler\typing\null.testsuite
+    // stop at bossa.syntax.fun:52
     checkAssignment(to.getType(), e.value);
+    
+    if( null != variable ){
+      let valueType = e.value.type, toType = to.type, varType = variable.type;
+      if(  null != valueType && null != toType && null != varType ) try{
+        checkNotNull( valueType ); // Will throw a TypingEx if the 'value' is not a sureTC.
+        boolean already = false;
+        try{ checkNotNull( toType ); already = true; }catch(mlsub.typing.TypingEx good) {}
+        if( ! already ){
+          bossa.util.User.warning( e, e.toString() );
+          mlsub.typing.Monotype type = varType;
+          mlsub.typing.Monotype sureType = makeSure( type );
+          setVarType( variable, now: sureType, out: type );
+        }
+      }catch(mlsub.typing.TypingEx skip) {}
+    }
+    
   }
   catch(mlsub.typing.TypingEx t){
     if (variable != null) {


With this the
<mac-nicec-new package="bossa.syntax" args="--recompile-all" />
of the Ant script (target "compiler2") passes successfully,
which meanst that the compiler was recompiled with intermediate self,
but the next line, where the new compiler is used, is failing with

     [java] nice.lang: parsing

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

     [java] Stack trace:
     [java] Exception in thread "main" nice.tools.code.EnsureTypeProc has wrong type
     [java]     at gnu.mapping.WrongType.make(WrongType.java:56)
     [java]     at bossa.syntax.fun.createMemberMethod(niceMethod.nice:259)
     [java]     at bossa.syntax.MethodContainer.createMemberMethod(methodContainer.nice)
     [java]     at bossa.parser.Parser.internalMethodOrFunction(Parser.java:904)
     [java]     at bossa.parser.Parser.interfaceDefinition(Parser.java:1445)
     [java]     at bossa.parser.Parser.definition(Parser.java:2389)
     [java]     at bossa.parser.Parser.readDefinitions(Parser.java:2433)
     [java]     at bossa.parser.Parser.module(Parser.java:3006)
     [java]     at bossa.parser.JavaccParser.read(JavaccParser.java:70)
     [java]     at bossa.modules.Content.read(Content.java:111)
     [java]     at bossa.modules.Content.getDefinitions(Content.java:86)
     [java]     at bossa.modules.Package.read(Package.java:122)
     [java]     at bossa.modules.Package.<init>(Package.java:88)
     [java]     at bossa.modules.Package.make(Package.java:59)
     [java]     at bossa.modules.Package.make(Package.java:45)
     [java]     at bossa.modules.fun.setMainPackage(Compilation.nice:87)
     [java]     at bossa.modules.Compilation.setMainPackage(Compilation.nice)
     [java]     at nice.tools.compiler.fun.compile(interface.nice:37)
     [java]     at bossa.modules.Compilation.compile(Compilation.nice)
     [java]     at nice.tools.compiler.console.fun.compile(main.nice:165)
     [java]     at nice.tools.compiler.console.dispatch.compile(Unknown Source)
     [java]     at nice.tools.compiler.console.fun.main(main.nice:199)
     [java]     at nice.tools.compiler.console.dispatch.main(Unknown Source)

What this error means?
Am i going in the right direction?
Any further recommendations?




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click