Commit Graph

87046 Commits

Author SHA1 Message Date
Roman Golyshev 29bb8cea8f [FIR] Add missing ensureResolved to FirClassSubstitutionScope
`createNewTypeParametersAndSubstitutor` call might need resolved types
to be able to work correctly with the generics' type bounds
2021-10-29 15:59:35 +03:00
Georgy Bronnikov 534beb8553 IR: Test for toSkip(this) in T.resolveFakeOverride()
^KT-49371 Fixed
2021-10-29 12:13:57 +03:00
David Saff c67a1ee2e5 Add a dry-run arg to show what _would_ be run, without actually running (#4630) 2021-10-29 11:38:56 +07:00
Sergey Bogolepov d072a3ca59 [K/N] Fix fileCheckTest temporary files dir 2021-10-29 04:07:31 +00:00
Sergey Bogolepov 95bd5fcc4b [K/N] Update filecheck tests for different ABIs 2021-10-29 04:07:31 +00:00
Sergey Bogolepov 49fdeb73ee [K/N] Make default LLVM attributes target-specific
Unfortunately, the world of native development is diverse,
and we can't generate one bitcode that is correct on every platform.
What is important to us is that AAPCS64 and Windows x64 extend
<32 bit arguments on callee side, so we can't use zext/sext args for them.
2021-10-29 04:07:30 +00:00
Sergey Bogolepov fdd020eab6 [K/N] Tests for function attributes in bitcode generator
Besides, well, tests themselves, this commit extends FileCheck infra to
make it possible to test bitcode for direct and reverse interop.
2021-10-29 04:07:30 +00:00
Sergey Bogolepov 851f4d86d9 [K/N] Include cstubs into -Xsave-llvm-ir
This way we are able to FileCheck interop bridges.
2021-10-29 04:07:29 +00:00
Sergey Bogolepov 71fb8f90d4 [K/N] Drop UnsignedValuePassing
We don't need it anymore since codegen now handles unsigned types.
2021-10-29 04:07:29 +00:00
Sergey Bogolepov e37d669dc3 [K/N] Opt-in for meaningful names for in "objc2kotlin" bridges
It is hard to run FileCheck tests over generated ObjC bridges because
they share the same name ("objc2kotlin"). To overcome this hurdle,
this commit introduces a compiler flag that appends function name to
"objc2_kotlin". This change might be useful for end-users, for example,
it makes stacktraces more readable. But it will require additional
testing and polishing which is out of the scope of this change.
2021-10-29 04:07:28 +00:00
Sergey Bogolepov cf3296c94c [K/N] LLVM attributes at call-sites
(I messed up commit history and all changes had to be squashed. Sorry.)

The commit is originated from KT-48591. The root of the problem is
following: we unconditionally added sext to all value parameters of
imported functions. To fix this problem we have to pass zext/sext
depending on the parameter type.

To make things right and future-proof, we decided to refactor
a significant part of IR to bitcode translator: when generating callsite
compiler "looks" at callee and applies its attributes to the callsite.
There are several sources of attributes:
1. External LLVM functions from runtime: just copy-paste attributes.
2. Direct IR calls: infer attributes from the declaration.
3. Virtual calls: use available declaration, so almost the same as prev.
4. External declarations functions: manual labor!

Specifying attributes at all callsites (including Kotlin->Kotlin) makes
things uniform and a little easier to implement.
All in all, the delta is significant, but comprehensible. In some places
I managed to make it seamless by changing declaration type and its
usages types simultaneously. In others (ObjCExport), unfortunately,
things got a little messy.

#KT-48722 fixed
2021-10-29 04:07:28 +00:00
Svyatoslav Kuzmich a13329fc65 [JS IR] Regenerate and mute test 2021-10-28 22:39:09 +03:00
Artem Kobzar 790e8843f9 fix(JS_IR): add outer classes resolving inside the function inliner. 2021-10-28 17:34:58 +00:00
Artem Kobzar 7f7aa9a921 feat(Inner Classes): generate typescript type definitions and JS for Inner Classes. 2021-10-28 17:33:41 +00:00
Ivan Kochurkin 744191099c [FIR] Fix false positive "return required" for if/else with inlined return in branch
^KT-49289 Fixed
2021-10-28 20:02:25 +03:00
Svyatoslav Kuzmich 5b10396f48 [stdlib] Test that modification of the array returned by toCharArray() doesn't affect the original string 2021-10-28 15:49:00 +00:00
Svyatoslav Kuzmich f7d3cb269f [Wasm] Support passing lambdas from Kotlin to JS 2021-10-28 18:47:38 +03:00
Svyatoslav Kuzmich 766377a041 [Wasm] Remove WasmForeign annotation
No longer needed since external interfaces are supported
2021-10-28 18:47:38 +03:00
Roman Artemev 23ad0e7c63 [TEST] Add test checking cast to DNN type
muted temporary due to required support in backends
2021-10-28 18:03:14 +03:00
Roman Artemev 5b19c41373 unmute jvm test 2021-10-28 18:03:13 +03:00
Roman Artemev 4424512bd6 [TEST] Add irText test for DefinitelyNotNull type 2021-10-28 18:03:12 +03:00
Roman Artemev d809e260cb [KLIB] Support DefinitelyNotNull type in KLIB
- add proto message
 - serialize/deserialize
2021-10-28 18:03:11 +03:00
Roman Artemev 29728efbf7 [PSI2IR] Support DefinitelyNotNull type translation in Psi2Ir 2021-10-28 18:03:11 +03:00
Roman Artemev 101afded69 [IR] Introduce IrDefinitelyNotNullType in IR
- support it in render
 - support in IR copy
 - KEEP-268
2021-10-28 18:03:09 +03:00
Tianyu Geng b48870c11f FIR checker: pass expected array type in ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_FUNCTION
This is needed by the IDE quickfix to generate the correct `arrayOf` (or
`intArrayOf`, etc`) wrapper call.
2021-10-28 16:36:02 +03:00
Mikhail Glukhikh 9f062df258 FE: fix factory and message for EXPOSED_FROM_PRIVATE_IN_FILE
#KT-49442 Fixed
2021-10-28 16:24:43 +03:00
Ivan Kylchik 1a52512578 [JS TESTS] Restore AbstractIrCodegenWasmJsInteropJsTest in generator 2021-10-28 15:18:30 +03:00
Dmitriy Novozhilov 0cce0fbbfb [FIR] Remove unused methods from FirProvider
Those methods were created for first prototype of FIR plugin API, and
  now they are completely redundant
2021-10-28 15:01:22 +03:00
Dmitriy Novozhilov acab58a314 [FIR] Cleanup builder inference utility 2021-10-28 15:01:20 +03:00
Dmitriy Novozhilov 4490f64666 [FIR] Get rid of FirAnnotatedDeclaration
Now all fir declarations have annotations

^KT-49260 Fixed
2021-10-28 15:01:18 +03:00
Nikolay Lunyak 0eb2d117ef [FIR] KT-45972, KT-49072: Add visibility checks to the type resolution 2021-10-28 14:31:27 +03:00
Jinseong Jeon 2dc2a90755 Introduce an API to convert TypeConstructorMarker to TypeParameterMarker 2021-10-28 12:54:45 +03:00
Sergej Jaskiewicz a367b91aa1 [IR] [Refactoring] Add toString and String::plus to IrBuiltins
Also use `OperatorNameConventions` constants instead of magic strings
2021-10-28 08:35:11 +00:00
Alexander Dudinsky f8dd1b3512 Fix Gradle Integration Tests MPP and Android on MacOS 2021-10-28 11:34:06 +03:00
Ilya Chernikov 600529fe21 temp: fix testdata until diagnostic reporting is fixed properly
currently some old backend reporting schemes are used in IR backend that
rely on the PSI alement passing. This conflicts with updated generic
diagnostic infrastructure that is shared between FIR and IR backends.
As soon as such places will be abstracted out and the IR will be
completely switched to the new diagnostic infrastructure, this and
similar changes could be reverted.
2021-10-27 22:17:42 +02:00
Ilya Chernikov cb513ee333 IR: fix ACCIDENTAL_OVERRIDE reporting on annotation implementations 2021-10-27 22:17:42 +02:00
Ilya Chernikov 81e4f3091a [minor] unmute suppress test on FIR - suppression works properly now 2021-10-27 22:17:42 +02:00
Ilya Chernikov 5bdda9c7f8 Implement suppression cache based on IR tree, use it in reporter 2021-10-27 22:17:42 +02:00
Ilya Chernikov 932eab8dfc Implement semi-lazy PSI-based suppress cache for IR
calculates suppressions per root (KtFile) basis on demand.
2021-10-27 22:17:42 +02:00
Ilya Chernikov bfe31c97ac Add support for ASTs without parents to suppress cache 2021-10-27 22:17:42 +02:00
Ilya Chernikov 7ef806b2ed Extract AbstractKotlinSuppressCache to frontend.common 2021-10-27 22:17:42 +02:00
Ilya Chernikov 70259cc228 Extract psi- and descriptior-independent suppress cache logic 2021-10-27 22:17:41 +02:00
Ilya Chernikov 70366dc7a6 Refactor diagnostic & result reporters...
to better reflect actual roles
2021-10-27 22:17:41 +02:00
Ilya Chernikov ea1edc2bd9 Add equality to diagnostic context, simplifying deduplication 2021-10-27 22:17:41 +02:00
Ilya Chernikov 34cbb3d356 Add support for new backend diagnostic to test infrastructure 2021-10-27 22:17:41 +02:00
Ilya Chernikov fc176e9845 Refactor IR reporting and infrastructure 2021-10-27 22:17:41 +02:00
Ilya Chernikov da2d3f29da Add multiple renderer sources support to new diagnostics infrastructure 2021-10-27 22:17:41 +02:00
Ilya Chernikov 0de6f8b915 Add multiple renderer sources supprt to new diagnostics infrastructure (move only to save history) 2021-10-27 22:17:41 +02:00
Ilya Chernikov 1ce4075112 Prepare CLI reporting infrastructure for non-PSI diagnostics 2021-10-27 22:17:40 +02:00
Ilya Chernikov 5446168770 Add path to FirFile to pass it to the DiagnosticContext 2021-10-27 22:17:40 +02:00