Commit Graph

103975 Commits

Author SHA1 Message Date
aleksandrina-streltsova aa0eca6d6d [AA] Provide KtCallableSymbol for static Java members
^KTIJ-25126 Fixed
2023-08-24 22:17:48 +03:00
Nikita Bobko b87958d04a Cleanup: drop unused ExpectActualCompatibility.Incompatible.Unknown 2023-08-24 16:56:53 +00:00
Anton Bannykh c09fa093fc [JS] set LV=1.9 in a K1 IC test 2023-08-24 16:00:54 +00:00
Svyatoslav Scherbina 0a2348e595 Native: add debugger test for inspecting string variables
We just had no tests checking that debugger can properly show values
of string-typed variables. This commit adds such a test.
2023-08-24 15:03:27 +00:00
Svyatoslav Scherbina 4774912fdc Native: don't use aliases for kclass:* globals, fix KT-61417
Currently, when generating a TypeInfo with a vtable attached, the K/N
compiler generates two globals to the resulting LLVM module:
- "ktypeglobal:$fqName#internal" -- an internal global of the aggregate
type (TypeInfo+vtable)
- "kclass:$fqName" -- an internal or hidden alias pointing to the
TypeInfo part of that global

The reason for emitting two globals is to have everything strict-typed,
since other LLVM modules might import the kclass as a TypeInfo.
Importing an aggregate TypeInfo+vtable global as a TypeInfo global works
too, of course. It is just a little bit less clean.

The new Xcode 15 linker now emits symbols for the ktypeglobal to the
symbol table, including an STSYM. This happens for classes compiled to
cache, when the kclass is hidden, not internal.

The problem is: for some reason, such an STSYM for
"ktypeglobal:kotlin.String#internal" makes lldb find a wrong address
(0xffffffffffffffff) for "kclass:kotlin.String", despite those being
two different symbol names. This seems to be related to them having
the same address though.
The K/N lldb script, konan_lldb.py, uses "kclass:kotlin.String" to
determine if an object is a string, in order to display it properly.

Therefore, using the new Xcode 15 linker when compiling with caches
makes the debugger unable to display string variables properly. As a
side effect, this also breaks displaying array-typed variables (because
the script first checks if an object is a string).

This commit fixes this by removing ktypeglobals completely, making the
compiler emit only a kclass as an aggregate global directly.

Now, there are other ways to fix the problem. For example, making the
ktypeglobal private instead of internal, or making konan_lldb.py use a
runtime function instead of querying "kclass:kotlin.String" directly.
But it seems that LLVM aliases are not common on darwin platforms. For
example, Clang doesn't support `__attribute__((alias(...)))` on these
platforms.
So it is safer to just stop using aliases here.

^KT-61417
2023-08-24 15:03:27 +00:00
Nikita Bobko 070f0197fc Cleanup: put expect actual parameters in the same order
Motivation: Consistency with `checkExpectActualScopeDiff` function
2023-08-24 12:43:46 +00:00
Alexander.Likhachev a3e8767fb1 [Gradle] Fix classpath cache key in ClassLoadersCachingBuildService
Lists have defined contracts for equals and hashCode and thus might be used as map keys for the sake of caching. Gradle's file collections do not follow those contracts, leading to cache misses and creating too many classloaders.
#KT-61426 Fixed
2023-08-24 11:59:07 +00:00
Alexander.Likhachev 693b4cf308 [Gradle] Fix creating empty directory marker for backups
The problem was occurring in the case the first directory for backup does not exist
#KT-61273 Fixed
2023-08-24 11:47:17 +00:00
Alexander.Likhachev 9b9039d512 [Gradle] Add a test for KT-61273 2023-08-24 11:47:17 +00:00
Anastasia.Nekrasova aef6787e87 [Test] Add a test covering changes in the evaluation semantics of safe call with smart cast in K2
Addition to other safe call tests that are already present in tests.

^KT-41034
2023-08-24 11:38:13 +00:00
Kirill Rakhman 12b3fbd39a [RAW FIR] Refactor destructuring code
Move destructuring related code into common to reduce
differences between PSI and LT.
2023-08-24 11:07:46 +00:00
Kirill Rakhman 8de36c416e [RAW FIR] Put destructuring statements outside of main lambda block
This fixes a false positive REDECLARATION when you want to shadow
a destructured lambda parameter inside the lambda.

#KT-60771 Fixed
2023-08-24 11:07:45 +00:00
Ivan Kylchik 6a9c50325e [Generator] Add otherKind parameter to conversion methods 2023-08-24 08:59:49 +00:00
Ivan Kylchik adce2c9a78 [WASM] Replace deprecated Char.toInt() with Char.code 2023-08-24 08:59:49 +00:00
Ivan Kylchik ee973c0ede [Generator] Generate Char class 2023-08-24 08:59:49 +00:00
Ivan Kylchik 38e434bc07 [Generator] Generate Boolean class 2023-08-24 08:59:49 +00:00
Ilya Gorbunov 3f3cd2e87a [Generator] Set up body for rangeTo and rangeUntil by default
Also use expression body formatting for `rangeTo`.
2023-08-24 08:59:49 +00:00
Ivan Kylchik 097535aeea [Generator] Replace IntrinsicConstEvaluation string with const property 2023-08-24 08:59:49 +00:00
Alexander Shabalin ba49879b5e [K/N] Disable tests with aux threads with tsan 2023-08-24 08:33:38 +00:00
Alexander Shabalin aac53b699e [K/N] Make hostRuntimeTests for arm64 macOS also run x64-tsan 2023-08-24 08:33:38 +00:00
Yan Zhulanow 3e12693f94 [fir2ir] Ensure the property is resolved before mapping its initializer
In partial module compilation, especially inside the IDE, only a few
files from the project are passed to fir2ir. FIR in these files might
contain references to declarations from other files.

As the FE doesn't usually care about called property initializers,
called properties might be resolved to 'CONTRACTS' or even 'STATUS'.
The backend, however, might need to inline constant expressions from
properties.
2023-08-24 07:54:57 +00:00
Yan Zhulanow 981dde26ea [LL API] Migrate type reference check to FirExpression.type
'FirExpression.typeRef' is deprecated. Its new, temporary replacement
is not passed to visitors, so the reference-handling code became dead.
2023-08-24 07:54:57 +00:00
Yan Zhulanow d70dbbc4cf [LL API] Resolve properties called inside code fragments
'CodeFragmentCapturedValueAnalyzer' assumes the analyzed code fragment
is then passed to the backend. For property calls, there are several
code generation strategies (field, accessor, delegate). In order to
be able to choose one, the whole property, including its possibly
'const' initializer, must be resolved.

The commit fixes a plenty of 'FirIdeNormalAnalysisSourceModuleCompilerF\
acilityTestGenerated.CodeFragments.Capturing' tests that broke after
the 'FirExpression.type' refactoring.
2023-08-24 07:54:57 +00:00
Kirill Rakhman 7fde5af7f8 [FIR] Rename FirExpression.coneType to resolvedType 2023-08-24 07:54:57 +00:00
Kirill Rakhman ab6d87a1a2 [FIR] Introduce deprecated FirExpression.typeRef property for compatibility with Compose
#KT-59855
2023-08-24 07:54:57 +00:00
Kirill Rakhman a5cff6ae36 [FIR] Make type of special expressions immutable 2023-08-24 07:54:57 +00:00
Kirill Rakhman 8d7c5b375e [FIR] Replace usages of FirExpression.typeRef with coneTypeOrNull
#KT-59855 Fixed
2023-08-24 07:54:57 +00:00
Kirill Rakhman f60d81097c [FIR] Adapt FIR renderer after FirExpression.coneTypeOrNull introduction
#KT-59855
2023-08-24 07:54:57 +00:00
Kirill Rakhman bc27feace4 [FIR] Adapt FIR utilities after FirExpression.coneTypeOrNull introduction
#KT-59855
2023-08-24 07:54:57 +00:00
Kirill Rakhman 7223cd1bf3 [FIR] Update custom FIR implementations after FirExpression.coneTypeOrNull introduction
#KT-59855
2023-08-24 07:54:57 +00:00
Kirill Rakhman b24afa0177 [FIR] Regenerate FIR tree after FirExpression.coneTypeOrNull introduction
#KT-59855
2023-08-24 07:54:57 +00:00
Kirill Rakhman bec39a9258 [FIR] Change FIR structure by replacing FirExpression.typeRef with cone type
#KT-59855
2023-08-24 07:54:56 +00:00
Kirill Rakhman 270aa1656f [FIR] Add default parameter values to ClassId.constructClassLikeType
#KT-59855
2023-08-24 07:54:56 +00:00
Kirill Rakhman e50025f21f [FIR2IR] Replace FirExpression.typeRef.toIrType with coneType.toIrType
#KT-59855
2023-08-24 07:54:56 +00:00
Kirill Rakhman 9ec814b7ad [FIR] Replace FirExpression.typeRef.coneType (and variants) with FirExpression.coneType
#KT-59855
2023-08-24 07:54:56 +00:00
Kirill Rakhman 1472b21993 [FIR] Don't use called declaration as source for call typeRef
Otherwise, we end up with sources pointing to different files.

#KT-60760 Fixed
2023-08-24 07:54:56 +00:00
Nikolay Lunyak 82c18ff26b [FIR] Report NON_MEMBER_FUNCTION_NO_BODY
^KT-59944 Fixed
2023-08-24 07:49:20 +00:00
Ilya Gorbunov e103318432 kotlin-test-js: assemble sources jar that combines common and platform sources, KT-61315, KTIJ-23784 2023-08-24 01:24:07 +00:00
Dmitrii Gridin 2cb6ee81a1 [LL FIR] add guards to type resolver
We should protect return types from value parameters/property accessors
and backing fields from repeatable modifications.
Such declarations can be modified during type resolution by
`transformTypeToArrayType` or property getter type propagation,
so we should be able to restore the original reference in the case of
exceptions (PCE for instance)

^KT-61422
2023-08-23 20:05:18 +02:00
Dmitrii Gridin 2f8a64fff2 [AA FIR] fix exception from vararg parameter with invalid type
It is true that for vararg parameter `arrayElementType` always have to
be not null, but it required resolution to TYPES phase. But in case of
the error type, the type reference is treated as resolved, so we are not
obligatory to resolve such reference to TYPES, because we already have
the resolved type.
So we can make the rule of KtFirValueParameterSymbol#returnType less
strict, and varargElementType will effectively do the same as
lazy resolve + arrayElementType

^KT-61422 Fixed
2023-08-23 20:05:18 +02:00
Leonid Startsev 6e4d033f89 Promote deprecation on Flags API to ERROR
#KT-59440
2023-08-23 16:47:05 +00:00
Leonid Startsev 06c471d413 Remove deprecated Flag usages in MetadataDeclarationsComparator.kt
#KT-59440
2023-08-23 16:47:05 +00:00
Pavel Punegov 2b6ca6d8e1 [K/N] Exclude a part of the test that fails due to the ^KT-61418 2023-08-23 15:40:07 +00:00
Jingbo Yang 7a13173e6a Support fileAccessHistoryReportFile in KAPT
This change expanded KAPT to support a new param
'fileAccessHistoryReportFile', which reports all the classes used during
 annotation processing into a file, in the form of a list of URIs.

This is useful for build speed improvements described in https://engineering.fb.com/2017/11/09/android/rethinking-android-app-compilation-with-buck/.
Essentially, using the list of used classes, we can compile only
the dependencies that are really affected by the developer's
code changes and improve Kotlin build speed.

^KT-52853
2023-08-23 14:59:59 +00:00
Dmitriy Novozhilov 1b49ae3aab [Build] Update verification-metadata.xml 2023-08-23 14:57:22 +00:00
Dmitriy Novozhilov b193dc50b4 [Build] Exclude :scripting:dependencies-maven-all from JPS compilation 2023-08-23 14:57:22 +00:00
Dmitriy Novozhilov 20c46738b4 Advance bootstrap to 1.9.30-dev-1098 2023-08-23 14:57:21 +00:00
Troels Bjerre Lund f67ec22c24 [K/N] Fix the native performance benchmark build
kotlin.native.concurrent.FreezableAtomicReference was depricated, so it
has been replaced by a kotlin.concurrent.AtomicReference
2023-08-23 14:29:29 +00:00
Alexander Shabalin efa59eb589 [K/N] Adjust values for the initial and minimum heap sizes ^KT-61092 2023-08-23 14:00:32 +00:00
Mikhail Glukhikh 5ee50f50b5 K2/LC: set hasBackingField to false for expect properties
#KT-61173 Fixed
2023-08-23 13:48:48 +00:00