Commit Graph

67 Commits

Author SHA1 Message Date
Alexander Udalov
a2612c1eae Fix generic signature for KSuspendFunction types in bytecode
#KT-27560 Fixed
2018-11-12 18:53:23 +01:00
Dmitry Petrov
ab90b2b901 Fix nullability propagation in inline class type mapping
#KT-27096

See https://jetbrains.slack.com/archives/C06E082M6/p1537949572000100
2018-09-28 10:46:42 +03:00
Dmitry Petrov
8158dd0c83 Update testData for writeSignature tests 2018-09-07 10:25:59 +03:00
Dmitry Petrov
99498eb7b8 Use 'name-hash' mangling scheme
'-' is allowed as a name character both in JVM and in Dalvik, but can't
be a part of a Java identifier.
2018-08-30 14:58:52 +03:00
Dmitry Petrov
a56d1d3ce8 Mangle function names with inline class parameters
Avoid name clashes in cases such as

  inline class Login(val login: String)
  inline class Password(val password: String)

  fun validate(login: Login) { ... }
  fun validate(password: Password) { ... }
2018-08-30 14:58:50 +03:00
Mikhael Bogdanov
ca5b19d0c6 Merge Java 8 write signature tests in common ones 2018-08-27 15:55:03 +02:00
Mikhael Bogdanov
efd93670f8 Migrate AbstractWriteSignatureTest.kt to CodegenTestCase stuff 2018-08-27 15:17:25 +02:00
Dmitry Petrov
b6e3218ca2 Use mapping mode for inline class underlying type without wrapping 2018-08-16 15:03:50 +03:00
Mikhail Zarechenskiy
ddf6c37e0e Prohibit inline classes with special underlying types
#KT-25328 Fixed
 #KT-23819 Fixed
2018-08-06 10:56:05 +03:00
Mikhail Zarechenskiy
d606e5bc89 Correct boxing for functional types containing inline classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy
a8a9f774d0 Map inline classes in generic argument position to theirs wrap classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy
4eb64fb4b9 Support mapping for inline classes based on type variables 2018-02-09 04:56:41 +03:00
Mikhail Zarechenskiy
928a342ace Initial version of codegen for inline classes 2018-02-05 12:07:40 +03:00
Mikhail Zarechenskiy
d1049e5553 Refine type mapping for nullable inline class types 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
d5400f11a3 Basic inline class mapping to the underlying representation 2018-02-05 12:07:39 +03:00
Mikhail Zarechenskiy
a0d7b703f4 Align generic signature for inner classes to work as in Java
#KT-10397 Fixed

According to JVMS (p. 4.3.4) inner classes should be separated with `$` in generic signature.

Note that in Java, inner types separated with `.` after first parameterized type, and now we preserve the same behaviour. See tests for clarification.
2017-04-27 15:47:28 +03:00
Alexander Udalov
0dbb02ec6a Fix generic signature for KFunctionN types on JVM
#KT-15473 Fixed
2017-01-11 13:15:24 +03:00
Michael Bogdanov
f8e9922c9e Don't generate generic signature for get/set methods in property reference class 2016-10-10 14:17:50 +03:00
Mikhael Bogdanov
cd6b709ef5 'bytecodeText' test for synthetic accessor generic signature converted to 'writeSignature' test 2016-05-04 17:07:48 +03:00
Mikhael Bogdanov
ee7bbbf530 Fix for KT-12127: Undeclared type variable on delegated property backing field
#KT-12127 Fixed
2016-05-04 17:07:48 +03:00
Michael Bogdanov
534a3a11d6 Write additional type parameters for DefaultImpls methods, fix for KT-11121: BadClassFile exception for interface implemented generic properties
#KT-11121 Fixed
2016-03-03 16:11:31 +03:00
Denis Zharkov
23d2b87a52 Ignore redundant projections for declaration-site variance 2016-01-14 19:20:00 +03:00
Denis Zharkov
154657a374 Fix wildcards for invariant arguments
See test with Java, we want preserve the invariant that if return type and
value parameter types are same in Kotlin, than we can use such return-value
as argument for that parameter
2015-12-15 16:18:31 +03:00
Zalim Bashorov
1e0b133e19 Find Nothing only in own arguments of generic type to make type raw and generate ''?" for contravariant position instead of use raw type 2015-12-07 19:25:59 +03:00
Denis Zharkov
303c756302 Refine generic signature for fields
- For vals use the same semantics as for return types
- For vars use the same semantics as for value parameters
2015-12-01 08:21:01 +03:00
Denis Zharkov
ddb67d6c9c Support JvmSuppressWildcards and JvmWildcard annotations
#KT-9898 Fixed
2015-12-01 08:21:00 +03:00
Denis Zharkov
406e31f54a Change default rules for declaration-site wildcards
Mostly this commit is about skipping wildcards that are redundant in some sense.
The motivation is that they looks `long` in Java code.

There are basically two important parts: return types and value parameters.

1. For return types default behaviour is skipping all declaration-site wildcards.
The intuition behind this rule is simple: return types are basically used in subtype position
(as an argument for another call), and here everything works well in case of 'out'-variance.
For example we have 'Out<Out<T>>>' as subtype both for 'Out<Out<T>>>' and 'Out<? extends Out<? extends T>>>',
so values of such type is more flexible in contrast to `Out<? extends Out<? extends T>>>` that could be used only
for the second case.

But we have choosen to treat `in`-variance in a different way: argument itself
should be rendered without wildcard while nested arguments are rendered by the rules
described further (see second part).

For example: 'In<Out<OpenClass>>' will have generic signature 'In<Out<? extends OpenClass>>'.
If we omit all wildcards here, then value of type 'In<Out<OpenClass>>'
will be impossible to use as argument for function expecting 'In<? super Out<? extends Derived>>'
where Derived <: OpenClass (you can check it manually :]).

And this exception should not be very inconvinient because in-variance is rather rare.

2. For value parameters we decided to skip wildcards if it doesn't make obtained signature weaker
in a sense of set of acceptable arguments.

More precisely:
    a. We write wildcard for 'Out<T>' iff T ``can have subtypes ignoring nullability''
    b. We write wildcard for 'In<T>' iff T is not equal to it's class upper bound (ignoring nullability again)

Definition of ``can have subtypes ignoring nullability'' is straightforward and you can see it in commit.

 #KT-9801 Fixed
 #KT-9890 Fixed
2015-12-01 08:20:59 +03:00
Denis Zharkov
8cb85759c7 Fix written generic signature in case of inner types 2015-11-13 14:59:03 +03:00
Denis Zharkov
9c8ad9e442 Fix AbstractWriteSignatureTest
It didn't check anything in tests with class signatures
2015-11-13 14:47:29 +03:00
Dmitry Petrov
e7fb7483c5 Drop package facades: update compiler tests. 2015-10-19 16:03:16 +03:00
Zalim Bashorov
9acf3e40de Generic type with Nothing in arguments compiles to raw type 2015-10-16 15:30:41 +03:00
Dmitry Petrov
a47eaa2cb5 Change part class naming scheme
update tests depending on part class naming
2015-09-07 16:28:42 +03:00
dnpetrov
a2b2eba1a1 Extended version of AbstractWriteSignatureTest:
- support multiple expectations in file
- support field signature expectations
- report failures in a more usable format
2015-06-17 13:45:08 +03:00
Denis Zharkov
2df6fcb785 Drop some tests using java.lang.Class in annotation
We are going to drop such cases anyway, but they're annoying when reverting commits
2015-06-12 09:55:02 +03:00
Dmitry Jemerov
4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Denis Zharkov
2a03994ecb JVM: Write signature for annotation parameter 2015-04-16 10:40:20 +03:00
Alexander Udalov
8af6ca5279 Delete kotlin.jvm.internal.KObject
It was supposed to be used in reflection but the benefits do not outweigh the
cost of KT-6951

 #KT-3223 Fixed
 #KT-6951 Fixed
2015-03-12 23:15:38 +03:00
Andrey Breslav
da639039bd KT-6698 Bad class file when using a star-projection on a Java's recursive generic parameter
#KT-6698 Fixed
2015-02-02 19:52:00 +03:00
Alexander Udalov
226bfe65f0 Don't make traits and annotations inherit from KObject
#KT-5609 Fixed
2014-08-13 17:19:56 +04:00
Alexander Udalov
f7b6457139 Replace "jet" package name with "kotlin" in testData 2014-03-02 19:55:26 +04:00
Alexander Udalov
0da92e22a2 Move jet.JetObject -> kotlin.jvm.internal.KObject
Don't use JetObject as a marker class in KotlinRuntimeLibraryUtil anymore,
since there are other classes for this purpose (KotlinPackage, Unit)
2014-03-02 19:54:58 +04:00
Evgeny Gerashchenko
836077916b Fixed tests after adding JetObject to generic signature. 2014-01-29 21:51:53 +04:00
Andrey Breslav
ed95463d1e Map Nothing to java.lang.Void 2013-10-25 15:39:01 +04:00
Andrey Breslav
7f46d7555e Do not write "? extends" and "? super" in immediate arguments of supertypes in Java generic signatures 2013-10-08 21:13:30 +04:00
Pavel V. Talanov
5f108905d1 Remove testing Kotlin signature from WriteSignatureTest 2013-08-26 15:59:34 +04:00
Yakov Zaytsev
bb364cd393 KT-3771 Fixed 2013-07-22 18:49:56 +04:00
Mikhael Bogdanov
d9fd04dd43 Refactoring: code duplication removed from accessor generators 2013-03-20 20:50:05 +04:00
Natalia.Ukhorskaya
47abdcf565 Rename namespace class to {package.name}Package
Conflicts:

	compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JavaElementFinder.java
2013-01-15 19:45:06 +04:00
Andrey Breslav
889ea107f6 Reflect Kotlin's declaration-site variance in Java signatures 2012-11-24 15:59:15 +04:00
Svetlana Isakova
45dbf36b53 added tests for kotlin signature for Map.Entry 2012-09-20 14:42:39 +04:00