Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

ContainsTypeMismatch false positive when contains is used as predicate function #46

Open
levinson opened this issue Aug 4, 2016 · 2 comments

Comments

@levinson
Copy link

levinson commented Aug 4, 2016

I've found a false positive with the ContainsTypeMismatch:

val foo = Some("foo")
val bar = Some("bar")

fails with the following:

foo.exists(bar.contains(_))
foo.exists(bar.contains)

... but works with:

foo.exists(str => bar.contains(str))
@levinson levinson changed the title ContainsTypeMismatch false positive w/ predicate function ContainsTypeMismatch false positive when contains is used as predicate function Aug 4, 2016
@HairyFotr
Copy link
Owner

For me foo.exists(bar.contains) gives a false positive (because Any is inferred by the compiler instead of String - am investigating why), but the other two work as expected.

@levinson
Copy link
Author

levinson commented Aug 4, 2016

Ah, my bad, it seems that foo.exists(bar.contains(_)) does indeed work. Thanks for looking into the issue. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants