Fix callable reference resolution regression

The regression appeared after
b5a8ffaddc
when we started trying both static and member methods until
first success and when there is no successful
we were just leaving the last one (e.g. private member)

But the actual problem is that we were commiting the trace
in case of single (but incorrect) result in resolution mode of
SHAPE_FUNCTION_ARGUMENTS when we couldn't yet choose the
correct static method

Also we shouldn't choose a shape for callable reference
using only the knowledge that result is single:
it may lead to the wrong inference result
(see test with Pattern::compile)

 #KT-17597 Fixed
This commit is contained in:
Denis Zharkov
2017-04-27 14:02:56 +03:00
parent 4b6667f599
commit c970763a7f
7 changed files with 59 additions and 2 deletions
@@ -0,0 +1,6 @@
// SKIP_TXT
import java.util.regex.Pattern
val strs: List<String> = listOf("regex1", "regex2")
val patterns: List<Pattern> = strs.map(Pattern::compile)