Commit Graph

30 Commits

Author SHA1 Message Date
Kirill Rakhman 2f3293f99e [FIR] Skip redundant INAPPLICABLE_CANDIDATE on call with unresolved callable reference argument
A new resolution diagnostic UnsuccessfulCallableReferenceAtom is
introduced that is used in EagerResolveOfCallableReferences.
No diagnostic is reported on unresolved calls with this diagnostic
because

#KT-59856
2023-07-20 07:29:18 +00:00
Mikhail Glukhikh 134284e496 FE: add test for KT-58055 2023-05-11 12:19:40 +00:00
Mikhail Glukhikh 0906258d03 K2: handle suspend anonymous functions properly in various compiler parts
#KT-58332 Fixed
2023-05-09 09:19:38 +00:00
Denis.Zharkov a8b9e8c44e K2: Fix false-positive TYPE_MISMATCH for suspend lambdas
Why did the problem existed?
At first, lambdas were analyzed with suspend function expected type,
because it's the WHEN-case and we propagate expected type info to
the branches.

Then, after the lambdas was introduced to the containing inference
system, we're creating ResolvedLambdaAtom using the information
from analyzed lambda's shape, but didn't use known lambda resulting
type (from which we might infer FunctionTypeKind).

So, the fix is just using that already obtained information.

^KT-57446 Fixed
2023-03-29 15:02:26 +00:00
Mikhail Glukhikh 32a73968de Stop tower resolve in K2 in more similar manner with K1 2022-07-27 15:29:41 +00:00
Mikhail Glukhikh 8f1d07084b FIR: introduce ILLEGAL_SUSPEND_FUNCTION_CALL & PROPERTY_ACCESS diagnostics 2021-07-30 19:06:46 +03:00
Ivan Kochurkin ad9b962536 [FIR] Fix tests (ARGUMENT_TYPE_MISMATCH instead of INCOMPATIBLE_CANDIDATE) 2021-04-12 23:49:55 +03:00
Mikhail Glukhikh f0ff9ad5a7 FIR: rename AMBIGUITY to OVERLOAD_RESOLUTION_AMBIGUITY to match FE 1.0 2021-04-02 16:22:01 +03:00
Jinseong Jeon bfc7eb7bab FIR checker: fix REFERENCE_BY_QUALIFIED positioning strategy to consider callable reference 2021-03-26 15:19:10 +03:00
Mikhail Glukhikh 4b823eca21 Fix test data (FIR_IDENTICAL) 2021-01-29 16:54:17 +03:00
Dmitriy Novozhilov 299272fa6d [Test] Update diagnostics testdata according to allowed suspend fun interfaces 2021-01-28 13:19:33 +03:00
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Jinseong Jeon 5fdd06676f FIR: discriminate candidates with suspend conversion 2020-09-10 11:31:24 +03:00
Jinseong Jeon 6de8ba40c1 FIR: initial support of suspend conversion on arguments 2020-09-10 11:31:24 +03:00
Mikhail Zarechenskiy e49cdf0ca2 Prohibit using suspend functions as SAM in fun interfaces
#KT-40978 Fixed
2020-08-10 22:04:16 +03:00
Jinseong Jeon 0e54f98b79 FIR: support adapted callable reference with vararg 2020-08-03 16:37:36 +03:00
Dmitriy Novozhilov f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00
Jinseong Jeon 5a3367e09c FIR: initial support of suspend conversion for function reference 2020-07-28 13:37:05 +03:00
Mikhail Zarechenskiy fb812301b2 Add test to preserve behaviour
It's important to have ambiguity in these cases to introduce overload
 resolution by suspend-modifier without breaking changes in future

 Relates to #KT-23610
2020-06-05 14:07:08 +03:00
Mikhail Zarechenskiy 6b0a803d14 Allow suspend-conversion for callable references as part of adaptation 2020-06-05 13:24:21 +03:00
Mikhail Zarechenskiy a4af833d55 Narrow down the range for compatibility warning to callee expression 2020-06-05 13:24:19 +03:00
Mikhail Zarechenskiy f073e34926 Update forgotten test-data 2020-06-01 15:35:24 +03:00
Mikhail Zarechenskiy 599f520fd8 Add compatibility warning for chained sam->suspend-conversion 2020-06-01 10:19:35 +03:00
Mikhail Zarechenskiy a5203428a4 Replace resolution error for suspend-conversion with call checker error 2020-06-01 10:19:34 +03:00
Mikhail Zarechenskiy eaeaf3c8a3 Add compatibility warning for suspend conversions 2020-06-01 10:19:33 +03:00
Mikhail Zarechenskiy 8bdc4d34f7 [NI] Commonize type-conversions (SAM/Suspend)
- Allow participating subtypes of functional types in conversions
 - Fix several subtle inconsistencies
 - Place logic about conversions at one place

 Now conversions operations have two stages: before usual subtyping
 check and after one. This is needed to support conversions of
 subtypes (of functional types, for example). First, the compiler
 checks if it possible to resolve an argument without conversion and
 only then it tries to perform conversion.
 Note that it'd be incorrect to perform conversion eagerly as it can
 change resolve (Runnable & () -> Unit <: KRunnable), plus we can't
 guess whether conversion is needed at all as it's important not to
 look into supertypes if resolution doesn't actually needed it

 #KT-36448 Fixed
 #KT-37574 Fixed
 #KT-38604 Fixed
2020-05-20 15:30:14 +03:00
Denis Zharkov e1e149a062 FIR: Support coercion-to-unit semantics for callable references 2020-05-18 11:17:45 +03:00
Mikhail Zarechenskiy cb975bde7c Add test for questionable chained fun -> suspend conversion 2020-04-22 16:10:45 +03:00
Mikhail Zarechenskiy ac642cf175 Support suspend conversion in callable reference adaptation
#KT-15917 In Progress
2020-04-22 16:10:45 +03:00
Mikhail Zarechenskiy 537a59d6ca Introduce basic suspend conversion in FE
#KT-15917 In Progress
2020-04-22 16:10:44 +03:00