Skip to content

Support of Casts In Uniqueness Checker #79

@The-Ray-Man

Description

@The-Ray-Man

The following test is accepted by the Uniqueness Checker. However the consume should not succeed because current is partially moved.

class A(
    @Unique val next : A?
)

fun <!VIPER_TEXT!>consume<!>(@Unique a : A) {}

fun <!VIPER_TEXT!>test<!>(@Unique a: A) {
    val current = a.next
    if (current != null) {
        val local = current.next
        consume(current)

    }
}

I think the problem is, that the CFG node for the access of current is followed by a SmartCastExpressionExitNode which seems to lose some information.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions