Why isn't this a valid contract? It says "Only ref...
# announcements
p
Why isn't this a valid contract? It says "Only references to parameters are allowed in a contract description". What does that mean?
h
It means, you can't reference a property (
value
in this case) in a contract. Only parameters of the method (but yours doesn't have any). Like this maybe? (untested)
Copy code
@ExperimentalContracts
fun isValidEmail(value: String?): Boolean {
	contract {
		returns(true) implies (value != null)
	}
	return value != null && mailRegex.matches(value)
}
p
Ah damn, this whould have been to good
h
Hm. I just tried it with one indirection, but the compiler doesn't check it two levels deep 🙍‍♂️ :
s
hmm, but this is an inline class .. . doesn't that mean
value
is
this
?!?