Commit Graph

3266 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 5cb7cf040a Update some testdata according switching compiler to 1.4 2020-01-20 16:41:46 +03:00
Pavel Kirpichenkov cb0b44273d [NI] Check stub types in result type
An uninferred parameter stub may leak through calculation of CST(Inv<Uninferred Stub>, Nothing) into a result type.
A stub type in the result type means a type error. So we can afford recalculating
CST with stub-containing types filtered out, since its an error anyway.
This prevents stub types leakages and helps with reporting type error diagnostics.

KT-35914 Fixed
KT-35943 Fixed
2020-01-20 11:11:31 +03:00
Mikhail Zarechenskiy 58c235e722 Set up tests for fun interfaces for JVM backend for now 2020-01-17 19:37:48 +03:00
Mikhail Zarechenskiy 76a78fe918 FIC: render fun before interfaces in descriptor renderer 2020-01-17 19:37:48 +03:00
Mikhail Zarechenskiy 8350cf7d14 FIC: rename FunctionConversion -> FunctionalConversion 2020-01-17 19:37:47 +03:00
Mikhail Zarechenskiy b98d8bd7c1 Regenerate tests after rebase on master, add FIR tests 2020-01-17 19:36:11 +03:00
Mikhail Zarechenskiy fc32e8b017 FIC: Add synthetic constructors for fun interfaces aka explicit FIC 2020-01-17 19:36:05 +03:00
Mikhail Zarechenskiy 0f242a9931 FIC: Support conversions for suspend functions 2020-01-17 19:36:04 +03:00
Mikhail Zarechenskiy f43769c50d FIC: Add diagnostic tests 2020-01-17 19:36:03 +03:00
Mikhail Zarechenskiy c71c1d45c6 FIC: Make SAM conversions also for fun interfaces, add base test 2020-01-17 19:36:01 +03:00
Mikhail Zarechenskiy 55935cc98a FIC: introduce language feature, modifiers checks and basic tests 2020-01-17 19:36:00 +03:00
Victor Petukhov 437a26684d NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed and remember flexibility of type parameters based on flexibility of its upper bounds
^KT-32435 Fixed
2020-01-17 19:16:09 +03:00
Mikhail Zarechenskiy 4f74515508 [NI] Fix CST calculation for covariant type projections 2020-01-16 17:18:20 +03:00
Ilya Gorbunov ac790bea71 Reorganize diagnostics tests with stdlib and reflect
DiagnosticsTestWithStdLib now require stdlib only.
Move test data accordingly.
The only test that required kotlin-reflect is transformed into
codegen box test.
2020-01-16 15:35:58 +03:00
Pavel Kirpichenkov 0d393e3fd7 [NI] Update filtering of constraints with equal types
Make check for synthetic nullability constraint status before skipping
new constraint with nonunique type.
2020-01-16 12:01:06 +03:00
Pavel Kirpichenkov 2896642f94 [NI] Consider synthetic lower nullability constraint non-proper 2020-01-16 12:01:06 +03:00
Denis Zharkov 676c99b933 NI: Fix exception during callable references overload resolution
^KT-35847 Fixed
2020-01-16 10:49:49 +03:00
Mikhail Zarechenskiy 588259a034 Add feature that allows references to synthetic properties with warning
See KT-35933 for details
2020-01-16 09:37:34 +03:00
Dmitriy Novozhilov a3037a081e [NI] Fix resolve of lambdas with expected function type with receiver
#KT-30245
2020-01-15 22:12:29 +03:00
Dmitriy Novozhilov 04ce10b6c1 [NI] Improve completing callable references with type variable as expected type
#KT-32462 Fixed
2020-01-15 22:12:28 +03:00
Mikhail Glukhikh cef71b0349 [FIR] Add static / companion ambiguity to test data
This is temporary test data change until we prioritize this properly
2020-01-15 16:52:12 +03:00
Mikhail Glukhikh f0ced642d9 [FIR] Use static & qualified scopes to access qualified callables
This commit provides more correct logic for creating scopes based
on FirResolvedQualifier & eliminates QualifiedReceiverTowerDataConsumer
2020-01-15 16:52:12 +03:00
Denis Zharkov d4c34afb94 NI: Do not resolve static callable references on generic types
As they weren't resolved in old inference

^KT-35920 Fixed
2020-01-15 16:10:34 +03:00
Denis Zharkov c48539feb3 NI: Fix callable references resolution when LHS is generic nested class
In case of null qualifier, we should not look into any static scope
NB: factory::createCallableProcessor returns NoExplicitReceiver processor
in case of null-receiver, that makes resolving the call in the test as
`property(::key)` that matches to the property itself, thus leading to
overload resolution ambiguity

^KT-35887 Fixed
2020-01-15 16:10:34 +03:00
Pavel Kirpichenkov 3fcf3d6fea Add regression tests
KT-32358
2020-01-15 14:39:40 +03:00
Pavel Kirpichenkov 396b226462 [NI] Restore missing smart casts after another smart cast in call
Expression type serves as a part of a key for retrieving smart cast info.
Rewriting expression type with SmartCastManager leads to incorrect processing of following smartcasts for same expression, therefore it was removed.

KT-32507 Fixed
KT-32358 Fixed
2020-01-15 14:39:40 +03:00
Dmitriy Novozhilov 88a1cb5a17 [NI] Use new type substitutor instead of old in completion of callable references
It's necessary because of new type substitutor is eager than odl, so
  if there is a substitution of type parameter deep inside type arguments
  then second substitutor wins against first

#KT-35896 Fixed
2020-01-15 14:01:25 +03:00
Denis Zharkov d6b01f1007 NI: In subtyping do not intersect arguments for non-covariant types
It partially reverts 7898922066
because it's not obvious that it's a safe operation
for invariant/contravariant types.

Also, there's a necessary fix in prepareReceiverRegardingCaptureTypes
to make types order stable
Otherwise test bareTypesWithStarProjections becomes flaky.

Also, the changes in bareTypesWithStarProjections.kt are also expected
because the type of the expression `coneSymbol` after the second "if" is
FirVariableSymbol<*> & FirPropertySymbol & AbstractFirBasedSymbol<*>
thus we fix D in the call `coneSymbol.phasedFir()` to FirVariableSymbol<*>
because it's the first type in the list
(see the next line after the last changed in AbstractTypeChecker)
2020-01-14 17:35:24 +03:00
Denis Zharkov 4202c9c1a4 NI: Fix regression for star-projections approximation
See the test added

^KT-35703 Fixed
2020-01-14 17:35:24 +03:00
Denis Zharkov 7255ee0a5b NI: Fix smart-cast related regression
See the test and the issue for the clarification
After the change 7898922066
the expected type for "a" in expression "foo(a)" is A<E & B<*>>
But we have the original type A<E> and smart-casted enriched type A<B<*>>
(non of them is a subtype of A<E & B<*>>)
and fail in checkTypeInternal when checking types in during completion

^KT-35844 Fixed
2020-01-14 17:35:24 +03:00
Pavel Kirpichenkov 4a29de3716 [NI] discriminate Nothing for reified parameters
Related issues: KT-32836, KT-35728
2020-01-14 16:27:42 +03:00
Mikhail Zarechenskiy 6fe61c9056 [NI] Fix ambiguity when there are no applicable candidates
#KT-35064 Fixed
2020-01-14 14:30:01 +03:00
Mikhail Glukhikh 5c6341b4e4 [FIR] Handle fully qualified expressions separately in tower resolver 2020-01-13 13:26:13 +03:00
Victor Petukhov 5917591205 Workaround an inliner problem upon which the compiler code itself stumbled
^KT-35856 Fixed
2020-01-10 12:13:46 +03:00
Mikhail Glukhikh 2b05320ae9 [Raw FIR] Synchronize enum entry building in PSI / light AST modes 2020-01-10 10:23:51 +03:00
Simon Ogorodnik 13132e69a3 [FIR] Start enum entries reworking 2020-01-10 10:23:50 +03:00
Pavel Kirpichenkov 96c1b96f3a [NI] Report "not enough information" on callable references in lambdas
^KT-34314 Fixed
2020-01-09 20:43:15 +03:00
Ilya Chernikov 9da536c202 [minor] "fix" fir testdata for KT-30245 test, todo: fix problems in fir accordingly 2020-01-09 08:08:45 +01:00
Ilya Chernikov caa677e6d2 [NI] Convert extension lambda to the non-extension one, if needed
#KT-30245 fixed
2020-01-09 08:08:45 +01:00
Simon Ogorodnik 1715f1a864 [FIR] Refactoring: create use-site scopes via scope provider 2019-12-30 12:52:58 +03:00
Pavel Kirpichenkov 2d21b82501 [NI] Remove hack for special functions
Treating special functions for `if`, `when`, `try`, `?:` as not accepting `Nothing` result type is incorrect.
Making so leads to cases with uninferred `Nothing` result type for inner calls and lost data flow info.
2019-12-27 18:40:42 +03:00
Mikhail Zarechenskiy 95dd322bf0 Update FIR diagnostics test 2019-12-27 14:11:47 +03:00
simon.ogorodnik 5e426fdc71 [FIR] Optimization & checking fix: remove usage of dispatchReceiverValue 2019-12-27 13:45:59 +03:00
Denis Zharkov caf02806d5 NI: Fix resolution ambiguity for references returned from lambda
^KT-32267 Fixed
2019-12-27 11:36:19 +03:00
Mikhail Glukhikh a54ef3e427 FIR invoke resolve: remove redundant candidates 2019-12-27 09:57:36 +03:00
Mikhail Glukhikh 0c88ecdc56 FIR resolve: introduce builtInExtensionFunctionReceiverValue
This commit allows us to distinguish extension lambda receivers
from simple extension receivers thus fixing some resolve problems.
2019-12-27 09:57:36 +03:00
Mikhail Glukhikh de50f8aef3 FIR resolve: add partial support of extension lambda calls
Here we introduce ONLY_IMPLICIT_RECEIVER tower level
to support extension lambda calls on local variables,
and soften extension receiver checks to make such extensions visible & applicable.
Also here we try to map arguments twice for functional types
2019-12-27 09:57:36 +03:00
Mikhail Glukhikh a8a50fa657 Fix raw FIR building with parenthesized expression as selector 2019-12-27 09:57:34 +03:00
Dmitriy Novozhilov 04e567dbf9 [NI] Don't replace context dependency for blocks with expected type
#KT-35702 Fixed
2019-12-26 20:31:06 +03:00
Mikhail Zarechenskiy 8871c8b4fd Migrate diagnostic tests to 1.4 2019-12-26 15:08:51 +03:00