I'm playing with Arrow Analysis (AA).
It seems like
require
is treated differently by the compiler compared with a project that doesn't use AA. Is this a correct observation?
For example, this, which doesn't explicitly use any AA features,
Copy code
fun fn() {
val x = 1
require(x == 1)
}
results in a compiler error:
could not parse predicate: x == 1
Whereas in a project without AA, there's no compiler error.
a
Alejandro Serrano Mena
03/18/2022, 8:40 AM
yes, this is right: AA treats the
require
blocks as preconditions on the arguments, so they must follow a specific pattern (be first, only mention argument names)
Alejandro Serrano Mena
03/18/2022, 8:40 AM
you can leave it here, but you'll get a warning about a predicate which cannot be treated by AA
j
julian
03/18/2022, 4:36 PM
Thanks @Alejandro Serrano Mena!
r
Richard Gomez
03/18/2022, 7:31 PM
Would it be possible to provide a clearer error message, or does
could not parse predicate
get returned for a variety of circumstances?
I am a mere mortal and probably wouldn't be able to figure out what that error/warning refers to.