I'm playing with Arrow Analysis (AA). It seems lik...
# arrow
j
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
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)
you can leave it here, but you'll get a warning about a predicate which cannot be treated by AA
j
Thanks @Alejandro Serrano Mena!
r
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.
a
of course, developer UI is key for a tool like AA to be useful. I've just created a ticket in the repo to track this https://github.com/arrow-kt/arrow-analysis/issues/23
🙌 2