Skip to content

returnOf on a nested property always fails #23

@a-xp

Description

@a-xp
class MyTest {
    
    class A {
        fun t(): Int {
            return 0
        }
    }
    
    data class B(val nested: A = A())

    @Test
    fun test() {
        val spec = validationSpec {
            constraints<B> {
                property(B::nested) {
                    valid()
                }
            }
            constraints<A> {
                returnOf(A::t) {
                    positive()
                }
            }
        }
        spec.validate(B())
    }
}

Throws: A.t() kotlin.Int must belong to class B(nested=A())) to be callable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions