Commit Graph

1400 Commits

Author SHA1 Message Date
Chris Smowton
8e5bbea9f9 Use map...firstOrNull not firstNotNullOfOrNull
The latter was introduced in Kotlin 1.5, so we can't use it in all supported versions.
2022-06-30 10:15:44 +01:00
Chris Smowton
2d98eb591e Kotlin: note that raw inner classes nest within a raw outer.
Previously the Java extractor did this but the Kotlin extractor nested them within an unbound outer type.
2022-06-30 10:15:44 +01:00
Ian Lynagh
3026456a39 Kotlin: Make more methods private 2022-06-28 14:38:13 +01:00
Ian Lynagh
780f5abc67 Merge pull request #9724 from igfoo/igfoo/private
Kotlin: Make more methods private
2022-06-28 10:21:55 +01:00
Ian Lynagh
b6790ef735 Merge pull request #9725 from igfoo/igfoo/inline
Kotlin: Extract inlineability of functions
2022-06-28 10:21:30 +01:00
Ian Lynagh
06060954ec Kotlin: Extract inlineability of functions 2022-06-27 19:25:56 +01:00
Ian Lynagh
4e4b34290b Kotlin: Make more methods private 2022-06-27 18:20:33 +01:00
Ian Lynagh
7430a413ad Kotlin: Mark DELEGATED_PROPERTY_ACCESSORs as compiler-generated 2022-06-27 17:57:40 +01:00
Ian Lynagh
861a368734 Merge pull request #9703 from igfoo/igfoo/generated
Kotlin: Record more kinds of elements as compiler-generated
2022-06-24 19:46:56 +01:00
Ian Lynagh
0ddd5bb162 Merge pull request #9709 from igfoo/igfoo/isLocalFunction
Kotlin: Let useFunction worry about isLocalFunction for us
2022-06-24 19:22:43 +01:00
Ian Lynagh
4791aaae52 Kotlin: Use an enum for compiler-generated-kinds
For now this is in KotlinFileExtractor, but we can move it out later if
we have generated things elsewhere.
2022-06-24 15:19:50 +01:00
Ian Lynagh
c0b6d1d093 Kotlin: Let useFunction worry about isLocalFunction for us 2022-06-24 14:24:02 +01:00
Ian Lynagh
46446f9dfa Kotlin: Move the isLocalFunction check deeper into useFunction 2022-06-24 14:22:45 +01:00
Ian Lynagh
20817a54da Kotlin: Mark enum class special members as cmopiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
50eeb47244 Kotlin: Mark <clinit> as compiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
c06eb09100 Kotlin: Record that DEFAULT_PROPERTY_ACCESSOR are compiler-generated 2022-06-24 14:00:47 +01:00
Ian Lynagh
5fc294d49e Kotlin: Record that generated data class members are compiler-generated 2022-06-24 14:00:47 +01:00
Tamás Vajk
381bcf7dad Merge pull request #9153 from tamasvajk/kotlin-simplify-loop-breaks-1
Kotlin: Unify loop `break`/`continue` statement handling between java and kotlin
2022-06-24 14:45:57 +02:00
Chris Smowton
d0e521ef4a Merge pull request #9681 from smowton/smowton/fix/reintroduce-obinit
Kotlin: reintroduce obinit when we have multiple secondary constructors and no primary
2022-06-24 10:25:24 +01:00
Chris Smowton
fcc8691394 Merge pull request #9625 from smowton/smowton/test/kotlin-1-7-support
Switch to using Kotlin 1.7 by default
2022-06-24 10:24:54 +01:00
Ian Lynagh
ae16a874c8 Merge pull request #9694 from igfoo/igfoo/useFunction
Kotlin: Some useFunction simplification
2022-06-24 09:31:14 +01:00
Ian Lynagh
eb1b3f801d Merge pull request #9689 from igfoo/igfoo/makeprivate
Kotlin: Make some more methods private
2022-06-23 21:28:07 +01:00
Ian Lynagh
bee703a870 Kotlin: Inline away useFunctionCommon 2022-06-23 21:23:21 +01:00
Ian Lynagh
3934491dcc Kotlin: Refactor useFunction*
They now work in a way more similar to other families of functions we
have.
2022-06-23 19:19:47 +01:00
Ian Lynagh
ab19d8c3c3 Kotlin: Move useFunctionCommon 2022-06-23 17:59:28 +01:00
Ian Lynagh
bd8a8d00aa Kotlin: Make some more methods private 2022-06-23 16:44:06 +01:00
Chris Smowton
b5010337a4 Avoid extracting needless obinit methods where we're only extracting a class' outline. 2022-06-23 16:26:54 +01:00
Chris Smowton
3cf7f96298 Ensure <obinit>'s return type is void not Unit 2022-06-23 16:26:54 +01:00
Chris Smowton
af5230349b Kotlin: reintroduce obinit when we have multiple secondary constructors and no primary
This avoids DB inconsistencies because complex initialisers are extracted to more than one function.
2022-06-23 16:26:54 +01:00
Chris Smowton
e64a8bc79a Use binary names not fqnames for uniquing IrDeclarations
Otherwise we fall into the trap of confusing the two overloads of `MapsKt.iterator` which have differing jvmnames.
2022-06-23 15:34:40 +01:00
Chris Smowton
57ea34d3ff Unique external classes/functions by fqname
Previously we used the IrDeclaration itself, but in Kotlin 1.7 this can be ambiguous because we can get more than one copy of a class in different modules.
2022-06-23 15:34:40 +01:00
Chris Smowton
8c57308661 Prevent extracting hidden functions
I'm not sure how these looked in 1.6 and below yet, but in 1.7 they appear with visibility = public, but a descriptor field set to indicate they have a name clash with a 'real' function.
2022-06-23 15:34:40 +01:00
Chris Smowton
2b2c384933 Kotlin: Move from 1.7.0-RC to 1.7.0 2022-06-23 15:34:40 +01:00
Chris Smowton
4899aabb05 Switch to using Kotlin 1.7 by default 2022-06-23 15:34:40 +01:00
Chris Smowton
45c85228bd Implement Kotlin 1.7 support
- Implement getIrStubFromDescriptor for Kotlin 1.7
- Stop using ClassSymbol.signature, which is now only populated for classes built from Kotlin, and noteworthily is null for primitive and other internally-synthesised types.
2022-06-23 15:34:40 +01:00
Ian Lynagh
3b2b884f09 Merge pull request #9683 from igfoo/igfoo/getDiagnosticLocation
Kotlin: Remove unused function getDiagnosticLocation
2022-06-23 14:09:00 +01:00
Ian Lynagh
1713c416c0 Kotlin: Remove unused function getDiagnosticLocation 2022-06-23 13:07:09 +01:00
Tamas Vajk
dabc956dbf Unify loop break/continue statement handling between java and kotlin 2022-06-23 08:45:11 +02:00
Chris Smowton
46e6203493 Merge pull request #9626 from smowton/smowton/fix/dont-emit-synthetic-parameter-names
Kotlin: don't emit synthetic parameter names
2022-06-22 15:30:54 +01:00
Chris Smowton
44cf260762 Merge pull request #9571 from smowton/smowton/fix/array-variance-lowering
Kotlin: Implement array type variance lowering
2022-06-22 13:38:21 +01:00
Chris Smowton
4b825df60c Kotlin: don't emit synthetic parameter names
The QL library already expects these to be missing in some cases and generates its own names when they are absent. Writing synthetic names to the database can produce inconsistencies if the true name is seen later.
2022-06-20 19:19:35 +01:00
Ian Lynagh
875776d91d Merge pull request #9581 from igfoo/igfoo/redundant_cast
Kotlin: Remove a redundant cast
2022-06-20 17:28:49 +01:00
Tamás Vajk
b16fcb72eb Merge pull request #9559 from tamasvajk/kotlin-fix-parcelize-symbols-3
Kotlin: substitute fake Parcelize functions with their real equivalent ones
2022-06-20 13:05:23 +02:00
Chris Smowton
92b8c0f864 Merge pull request #9563 from smowton/smowton/fix/name-trap-files-after-jvmnames
Kotlin: Name trap files after jvmnames
2022-06-17 12:32:28 +01:00
Ian Lynagh
9a7ff4bcdf Kotlin: Remove a redundant cast 2022-06-16 14:08:12 +01:00
Chris Smowton
a2c0fe4edb Fix Kotlin single-version build when the best candidate has trailing version info
For example, 1.7.0-RC would previously be truncated to 1.7.0 resulting in failure to build the single-version distro as all candidate alternate-version kotlin files would be ignored.
2022-06-16 13:25:59 +01:00
Chris Smowton
2d57d3aa78 Implement array type variance lowering
Kotlin permits introducing a `? extends ...` wildcard against an Array even though the class is final, so long as its argument itself can be extended (i.e. isn't final or is another array type satisfying this condition).

Contravariant arrays get lowered to Object[], and are subject to automatic `extends` wildcard introduction, unless their element type was already Any.
2022-06-15 18:36:56 +01:00
Chris Smowton
90e8d4e1de Name trap files after jvmnames
This should lead to better Java/Kotlin correspondence since the Java extractor will naturally name trap files for JVM names, and avoids a specific bug (tested) where MapsKt.iterator's two overloads (one taking `Map` and one `MutableMap`) are JvmName'd differently since their Java-lowered signatures would be identical. Without this change only
one of the iterator overloads would get extracted leaving the other one a dangling reference.
2022-06-15 11:55:58 +01:00
Tamas Vajk
c722921276 Kotlin: substitute fake Parcelize functions with their real equivalent ones 2022-06-15 10:35:48 +02:00
Chris Smowton
d390dc0316 Map java.lang.Number methods to their Java equivalents 2022-06-14 21:44:54 +01:00