Wiki

Ticket #41 (accepted defect)

Opened 16 years ago

Last modified 16 years ago

False warning for if statement on box var

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

Description

class X

	def main is shared
		x = X()
		x.compute

	var _foo as X?
	
	def compute
		if _foo
			.bar
			if _foo  # false warning here since .bar can change _foo
				.bar
	
	def bar
		_foo = nil

The warning is: foo.cobra(12): warning: The expression "_foo" (of type "X") will always evaluate to true because it is not nilable. You can remove the expression.

This is low priority as it comes up rarely.

Attachments

fixNoWarnings.patch Download (1.7 KB) - added by hopscc 16 years ago.

Change History

Changed 16 years ago by hopscc

Changed 16 years ago by hopscc

patch for failure of warning suppression on Boxes.cobra:853
see
 Spurious warning on compiler compile

Changed 16 years ago by Chuck

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

The problem addressed by the patch has been fixed, although I took a different approach and more importantly, added a test case to lock this down. changeset:1620

Note that the patch does not address the issue described by this ticket. It should not be confused as a fix for this ticket.

Note: See TracTickets for help on using tickets.