Wiki

Ticket #231 (new defect)

Opened 7 years ago

Last modified 4 years ago

all/for in invariant causes COBRA INTERNAL ERROR

Reported by: nevdelap Owned by:
Priority: minor Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

class A
	pass

class B

	var _list as List<of A>
	var _dict as Dictionary<of A, int>

	invariant
		all for a in _list get a in _dict.keys

# error: COBRA INTERNAL ERROR / InvalidOperationException / Operation is not valid due to the current state of the object

Change History

Changed 7 years ago by nevdelap

This slight variation with its different error message might help track down the problem.

class A
	pass

class B

	var _list as List<of A>
	var _dict as Dictionary<of A, int>

	cue init
		base.init
		_list = List<of A>()
		_dict = Dictionary<of A, int>()

	def _x as bool
		return all for a in _list get a in _dict.keys

	invariant
		_x

	def main
		pass

error: COBRA INTERNAL ERROR / NullReferenceException? / Object reference not set to an instance of an object

If _x is changed x, or a shared is used it compiles.

Changed 7 years ago by Chuck

Until this is fixed, a workaround could be to shove the condition into a method and reference the method in the invariant.

Changed 4 years ago by Charles

bump

Note: See TracTickets for help on using tickets.