Wiki

Ticket #345 (closed defect: wontfix)

Opened 11 years ago

Last modified 11 years ago

Misleading warning can be generated in ensure contract

Reported by: nerdzero Owned by:
Priority: minor Milestone:
Component: Cobra Compiler Version: 0.9.4
Keywords: Cc:

Description

This code...

class Example

    var _x = 0

    def main
        print _x
        .foo
        print _x

    def foo
        ensure old._x < _x
        _x += 1

generates this warning...

warning: An explicit dot (".") is unnecessary for accessing underscored members of the current object. You can remove "."

The warning is referring to old._x but you cannot remove the dot in this case. The warning should not be displayed.

Change History

Changed 11 years ago by nerdzero

  • status changed from new to closed
  • resolution set to wontfix

Okay, looking into the compiler code a bit more, I see that

ensure old._x < _x

is equivalent to

ensure old _x < _x

This was not immediately obvious to me. The warning is valid. I'll close this ticket.

Note: See TracTickets for help on using tickets.