Wiki

Ticket #219 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

'result' unassigned in ensure.

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

Description

use Cairo from Mono.Cairo

class Program

    def main
        pass

    def m1 as int
        ensure
            true implies result == 1 # OK
        body
            return 1

    def m2 as PointD
        ensure
            true implies result.x == 1 # error: Use of unassigned local variable "_lh_result"
        body
            return PointD(1, 1)

Change History

Changed 8 years ago by Chuck

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

Thanks for the report. That's definitely disconcerting. The use of "implies" is not required to trigger it, so:

use Cairo from Mono.Cairo

class Program

	def main
		pass

	def m1 as int
		ensure
			result == 1
		body
			return 1

	def m2 as PointD
		ensure
			result.x == 1  # false error: Use of unassigned local variable "_lh_result"
		body
			return PointD(1, 1)

Changed 8 years ago by Chuck

It's a struct thing which is why I never noticed it (my programs mostly use classes).

Changed 8 years ago by Chuck

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in changeset:2426

Note: See TracTickets for help on using tickets.