Ticket #41 (accepted defect)

Opened 4 months ago

Last modified 4 months 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 (1.7 kB) - added by hopscc 4 months ago.

Change History

Changed 4 months ago by hopscc

Changed 4 months ago by hopscc

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

Changed 4 months 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.