Skip to content

&& is not short-circuiting #511

@jcp19

Description

@jcp19

The following fails, even though it shouldn't

type X int

requires x != nil
func (x *X)test() bool

func clientX1(x *X) {
    if x != nil && x.test() {

    }
}

Error:

[info] Precondition of call x.test() might not hold. 
[info] Assertion x != nil might not hold.

Dually, it is likely that || is also not short-circuiting, although I haven't tested it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions