Commit Graph

268 Commits

Author SHA1 Message Date
Ian Lynagh
caa56c9cad Kotlin: compiler_arguments test: Normalise path separators in output
Otherwise we get different output on Windows vs Posix.
2022-10-31 16:31:08 +00:00
Ian Lynagh
067704a59a Kotlin: default-parameter-mad-flow test: Make kotlinc call work on Windows 2022-10-31 15:57:34 +00:00
Ian Lynagh
2783668092 Kotlin: compiler_arguments test: Fix running gradle on Windows 2022-10-31 15:29:23 +00:00
Ian Lynagh
6b5deee9a8 Kotlin: Reunite the parts of gradle_kotlinx_serialization 2022-10-31 14:55:58 +00:00
Ian Lynagh
d3934c97ed Kotlin: Run java-interface-redeclares-tostring on all platforms 2022-10-31 14:52:19 +00:00
Ian Lynagh
7c4df8c81f Kotlin: Run default-parameter-mad-flow on all platforms 2022-10-31 14:51:15 +00:00
Ian Lynagh
b1d9f9f9d5 Kotlin: Run compiler_arguments test on all platforms 2022-10-31 14:46:46 +00:00
Ian Lynagh
21600c612d Merge pull request #11037 from igfoo/igfoo/log
Kotlin: Integration tests: Allow \ as a path separator in logs test
2022-10-31 14:03:57 +00:00
Ian Lynagh
a53c2104d1 Kotlin: Integration tests: Allow \ as a path separator in logs test 2022-10-31 11:24:39 +00:00
Dave Bartolomeo
85790fcade Merge pull request #10964 from smowton/smowton/admin/modernise-qlpacks
qlpacks: libraryPathDependencies -> dependencies
2022-10-28 16:44:22 -04:00
Chris Smowton
d9744c81b7 Merge pull request #11017 from smowton/smowton/fix/kotlin-wildcard-suppression-annotation
Kotlin: fix wildcard suppression where the annotation applies to a parent type/argument.
2022-10-28 18:33:07 +01:00
Ian Lynagh
84427e132e Kotlin: Move the logs test to all-platforms 2022-10-28 17:56:41 +01:00
Chris Smowton
1914a114a2 Merge pull request #11018 from smowton/smowton/fix/kotlin-extension-specialisation
Kotlin: specialise extension receivers the same as other function parameters
2022-10-28 16:15:41 +01:00
Chris Smowton
24f87ac963 Kotlin: fix wildcard suppression where the annotation applies to a parent type/argument.
In the process I also fix the missed case where suppression can be switched off using a parameterized annotation.
2022-10-28 16:13:55 +01:00
Chris Smowton
ee63e60bb7 qlpacks: libraryPathDependencies -> dependencies 2022-10-28 16:07:36 +01:00
Ian Lynagh
49425e6c2a Kotlin: Integration tests: Make a couple more posix-only for now 2022-10-28 13:59:36 +01:00
Ian Lynagh
f387eb21eb Kotlin: Integration tests: Add a qlpack.yml 2022-10-28 10:53:45 +01:00
Ian Lynagh
382c08e3cd Kotlin: Fix some integrations tests on Windows 2022-10-28 10:53:45 +01:00
Ian Lynagh
15d5369bdd Kotlin: Run some integration tests on Windows too 2022-10-28 10:53:45 +01:00
Tamas Vajk
99880c980c Kotlin: Fix external location in integration test 2022-10-28 10:24:14 +02:00
Chris Smowton
45a4cd89a6 Kotlin: specialise extension receivers the same as other function parameters
This arises when a generic class extends one of its parameters; for example, `class G<T> { val T.v; get() = 1 }`, where specialisation `G<List>` should generate a method specialisation `getV(List)`.
2022-10-27 18:31:19 +01:00
Chris Smowton
5ef99ca5bd Merge pull request #11003 from smowton/smowton/fix/reintroduce-pointless-wildcards
Kotlin: reintroduce pointless wildcards when a Java declaration explicitly uses them
2022-10-27 16:06:21 +01:00
Ian Lynagh
6c232f95bc Kotlin: Fix integration tests on Mac 2022-10-27 13:48:04 +01:00
Chris Smowton
28b6e263ec Kotlin: reintroduce pointless wildcards when a Java declaration explicitly uses them
For example, Java code might use `HasOutVariance<? extends String>`, or `HasInVariance<? super Object>`, both of which are needless wildcards and which the Kotlin extractor would previously have refused to reintroduce due to their not specifying a larger type than their bound. However this led to inconsistency with Java extraction, which
extracts the type as it appears in source.

This seems to particularly happen with generated code, e.g. the output of the Kotlin protobuf compiler.
2022-10-26 20:05:27 +01:00
Ian Lynagh
37c40c58d2 Merge pull request #10959 from igfoo/igfoo/diags
Java/Kotlin: Add a diagnostics consistency query
2022-10-26 13:07:01 +01:00
Ian Lynagh
52cfc33576 Kotlin: Accept test changes 2022-10-25 16:26:12 +01:00
Tamas Vajk
80fa45fd8e Fix expected fest file after rebase 2022-10-25 13:52:25 +02:00
Tamas Vajk
f1e6b756e3 Add integration test with constant expression in a generated constructor 2022-10-25 13:52:25 +02:00
Chris Smowton
b9f4856d47 Merge pull request #10876 from smowton/smowton/feature/kotlin-default-method-auto-mad
Java models-as-data: infer Kotlin $default models from that of its parent function
2022-10-25 11:58:54 +01:00
Chris Smowton
c4ba644dfd Merge pull request #10952 from smowton/smowton/fix/java-interface-redeclares-tostring
Kotlin: extract interface redeclarations of `Object` methods
2022-10-25 11:29:10 +01:00
Chris Smowton
843f847960 Merge pull request #10921 from smowton/smowton/fix/ignore-enhanced-nullability
Kotlin: ignore enhanced nullability when extracting primitive types
2022-10-24 19:43:04 +01:00
Chris Smowton
7a0bded2ac Kotlin: support argument-range specifications for $default methods 2022-10-24 19:31:03 +01:00
Chris Smowton
8d10b1b77b Convert test to inline-expectation test 2022-10-24 19:15:35 +01:00
Chris Smowton
c6f4742f29 Kotlin: extract interface redeclarations of Object methods
Due to a probable compiler bug (?) the redeclaration looks like a fake symbol, leading to Java dispatching against a declaration that Kotlin doesn't believe exists.
2022-10-24 12:45:07 +01:00
Chris Smowton
42d6968c20 Kotlin: give external extension properties with matching name and file distinct trap filenames 2022-10-21 14:28:53 +01:00
Ian Lynagh
2e6d6e1538 Merge pull request #10894 from igfoo/igfoo/psi
Kotlin: Refactor PSI handling
2022-10-21 11:43:49 +01:00
Chris Smowton
7889d9cffa Kotlin: ignore enhanced nullability when extracting primitive types
Otherwise we'll mistake `@NotNull Integer` for `int` and similar, causing a mismatch vs. Java signatures.
2022-10-21 10:55:26 +01:00
Ian Lynagh
9bc0c98b8e Kotlin: Update logs test 2022-10-20 14:18:31 +01:00
Chris Smowton
e868cdf91b Merge pull request #9876 from smowton/smowton/feature/interface-forwarding
Kotlin: implement default interface forwarding
2022-10-20 10:17:47 +01:00
Chris Smowton
14b8892ced Don't create interface forwarders for other interfaces, and target super accesses correctly
Intermediate interfaces don't need interface forwarders, since the Kotlin compiler won't try to make them non-abstract by synthesising methods.

Super references should always target an immediate superclass, not the ancestor containing the intended implementation.
2022-10-19 15:37:06 +01:00
Ian Lynagh
83a3ae64c4 Kotlin: Accept test changes 2022-10-19 12:14:39 +01:00
Ian Lynagh
e6e0fe0cd4 Kotlin: Tweak custom_plugin/diagnostics test 2022-10-19 12:14:38 +01:00
Chris Smowton
b148e3168f Java models-as-data: infer Kotlin $default models from that of its parent function 2022-10-18 18:17:08 +01:00
Chris Smowton
fff9a75ff8 Accept test changes 2022-10-17 18:38:13 +01:00
Chris Smowton
e8a35983ee Implement Kotlin default interface method forwarding
Kotlin's implementation of defaults depends on the -Xjvm-default setting (or the @JvmDefault deprecated annotation, not implemented here): by default, actual interface class files don't use default method, and any class that would inherit one instead implements the interface calling a static method defined on TheInterface$DefaultImpls. With
-Xjvm-default=all or =all-compatibility, real interface default methods are emitted, with the latter retaining the DefaultImpls methods so that other Kotlin can use it.

Here I adopt a hybrid solution: create a real default method implementation, but also emit a forwarding method like `@override int f(int x) { return super.TheInterface.f(x); }`, because the Java extractor will see `MyClass.f` in the emitted class file and try to dispatch directly to it. The only downside is that we emit a default interface
method body for a prototype that will appear to be `abstract` to the Java extractor and which it will extract as such. I work around this by tolerating the combination `default abstract` in QL. The alternative would be to fully mimic the DefaultImpls approach, giving 100% fidelity to kotlinc's strategy and therefore no clash with the Java
extractor's view of the world.
2022-10-17 18:38:13 +01:00
Tamas Vajk
f2e2e3bc1d Kotlin: extract protected modifier from java class files 2022-10-10 18:02:21 +02:00
Tamas Vajk
15aab711c7 Kotlin: Add test showing missing java modifier 2022-10-10 18:01:38 +02:00
Chris Smowton
289843eb83 Remove accidentally duplicated test
This was moved to a unit test, but the integration test version was somehow retained.
2022-10-06 16:00:56 +01:00
Chris Smowton
86e5e4c4bc Accept test changes 2022-10-06 12:40:04 +01:00
Ian Lynagh
db673c0355 Merge pull request #10646 from tamasvajk/kotlin-java-kotlin-function-mapping
Kotlin: Simplify `kotlinFunctionToJavaEquivalent`
2022-10-04 13:46:22 +01:00