Wiki

Ticket #318 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

Internal Error (FallThrough Exception)

Reported by: torial Owned by: Chuck
Priority: major Milestone:
Component: Cobra Compiler Version: 0.9.3
Keywords: Cc:

Description

I received the following internal error:

error: COBRA INTERNAL ERROR / FallThroughException? / info='_type is nil. this=BoxVar?-sh(6613, name=bufferSize, didBindInh=false, didBindInt=false, didBindImp=false, token=Token(ID, 'bufferSize', 'bufferSize', ln 301, col 7, C:\Users\seanm\Desktop\Cobra\NajaNode?.cobra), name=bufferSize, isNames=['shared', 'readonly'], parentBox=Class-mi(6611, name=Config, didStartBindInh=true, didBindInh=true, didBindInt=false, didBindImp=false, token=Token(CLASS, 'class', 'class', ln 300, col 2, C:\Users\seanm\Desktop\Cobra\NajaNode?.cobra), didBindInh=true, isGeneric=false, isGenericDef=false, needsConstruction=false, 6611), typeNode=TypeIdentifier?-mi(6612, didBindInh=false, didBindInt=false, didBindImp=false, token=Token(INT, 'int', 'int', ln 301, col 21, C:\Users\seanm\Desktop\Cobra\NajaNode?.cobra), name=int, didResolveType=true, 6612), 6613)'
Compilation failed - 1 error, 0 warnings

Exit code: 1

This is w/ the latest code in SVN (as of 3/14/2013).

The error seems to be around this class:

	class Config
		var bufferSize as int  is shared, readonly 
		var traceLogging as bool is shared, readonly
		
		cue init is shared
			.bufferSize = 1024
			.traceLogging = false

This is a first pass attempt at porting as C# port of Node.js (from a few years back). The original C#:  http://newcome.wordpress.com/2010/05/08/node-net-node-js-implemented-in-javascript-on-the-net-runtime/ . Right now, I'm just trying to get it to compile...

Attachments

fwd-ref.patch Download (1.2 KB) - added by hopscc 12 years ago.

Change History

Changed 12 years ago by hopscc

I tried the code shard above standalone ( latest compiler ver) and it compiles runs without internal error..
Can you get it down to a standalone piece of code that fails???

For your build as an alternative you might get past this by using an alternate way to declare and init a shared var ( unfortunately its not obvious how to do this - the natural obvious way fails (see ticket:252 and ticket:34)

Looks like this:

    class Config
        var bufferSize as int = 1024
            is shared, readonly 
	var traceLogging as bool = false
            is shared, readonly

The indentation for the isnames clause is (at present, unfortunately) necessary.

Changed 12 years ago by nerdzero

There is also:

class Config
    const bufferSize = 1024
    const traceLogging = false

Right?

Changed 12 years ago by hopscc

Cant remember if 'const' patch has been activated or not.
(Obviously dont use it much/at all...)

Changed 12 years ago by torial

Below is the minimum subset of code that causes the error. It seems that the NetStream? class usage of Config.bufferSize is critical for this internal exception to occur.

use System.Threading
use System.IO
use System.Collections
use System.Collections.Generic
use System

namespace NajaNode
	class Server
		def main is shared
			pass
			
	class NetStream 
		var _bufferSize as int = Config.bufferSize
			
	class Config
		var bufferSize as int
			is shared, readonly 
		var traceLogging as bool 
			is shared, readonly
		
		cue init is shared
			.bufferSize = 1024
			.traceLogging = false

Changed 12 years ago by hopscc

Good-Oh.
Its some sort of forward reference issue - if the NetStream? dcl is placed after the
Config one it compiles fine....

Presumably the Config bufferSize has not yet passed through bindInt (and typed) when the NetStream? reference (doing its own binding/Typing) wants to use it.

Changed 12 years ago by hopscc

Changed 12 years ago by hopscc

  • owner set to Chuck
  • status changed from new to assigned

Heres a patch which seems to fix the issue and your test added to the test suite.

Changed 11 years ago by Charles

Thanks. changeset:2975

Changed 11 years ago by Charles

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.