Commit Graph

4593 Commits

Author SHA1 Message Date
Alexander Udalov 92534eadaa Remove dependency of 'resolution' on 'deserialization'
Replace it with a dependency on 'descriptors'.

Move the existing marker interface ContractProvider to 'descriptors',
and create a new marker interface DeserializedDescriptor.
2020-03-28 21:30:07 +01:00
Alexander Udalov d70271b6aa Move RequireKotlinNames to 'descriptors'
Also move version string regex there and rename the class to
RequireKotlinConstants. This allows to get rid of dependency of
'serialization' on 'frontend'.
2020-03-28 21:30:07 +01:00
Georgy Bronnikov b0d96eb140 Revert "Workaround for KT-37302"
This reverts commit ae208f58a4.
Issue fixed, workaround no longer needed.
2020-03-27 14:19:45 +03:00
Roman Golyshev 85bfbaa8a8 Check if returned typeParameters are null
- See EA-141456, EA-212070
2020-03-24 15:23:34 +03:00
Mikhail Zarechenskiy 191fb02bf6 [NI] Consider intersection type with number type as Nothing
Currently, only for "in": In<in Int & A> == In<in Nothing> == In<*>

 #KT-37302 Fixed
2020-03-23 16:39:21 +03:00
Mikhail Bogdanov 420dd0d440 Extract directive map to separate class 2020-03-19 16:45:10 +01:00
Ilya Chernikov 53d289206e Optimize hot TypeUtils.contains function
optimize for small number of visited types
2020-03-12 08:02:45 +01:00
Pavel Kirpichenkov 04f9a03796 [NI] Fix isNullableType for definitely not null type parameter
Consider type parameter with nullable bound not null
if it is inside of a definitely not null type.
2020-03-11 13:55:25 +03:00
Alexander Udalov ac6be2edba Treat class files with no bytecode version as having the current version
This has no effect currently because all class files produced by Kotlin
have the bytecode version in the metadata (currently 1.0.3).

However, this change will allow us to stop writing bytecode version to
metadata in Kotlin 1.5. In fact, we could do it while the default here
was INVALID_VERSION too, but then for example compiling with Kotlin 1.3
against binaries of version 1.5 would lead to extraneous "incompatible
bytecode version" errors (because INVALID_VERSION is basically 0, which
is incompatible to 1.0.3+), in addition to the correct "incompatible
metadata version" error.

The reason why we might want to avoid writing bytecode version is the
fact that the initial use case it was added for is already supported by
the metadata version, and the bytecode version error reporting was never
fully implemented. Actually bytecode version was almost unused because
of that.
2020-03-10 12:07:39 +01:00
Alexander Udalov d668808b44 Migrate Experimental->RequiresOptIn in project sources 2020-03-10 12:07:15 +01:00
Alexander Udalov 795d6ab407 Migrate UseExperimental->OptIn in project sources 2020-03-10 12:07:14 +01:00
Vladimir Dolzhenko 3c26d38804 Revert Clear computable when value is calculated in LockBasedStorageManager
Relates to #KT-35256
2020-03-10 09:10:46 +01:00
Georgy Bronnikov ae208f58a4 Workaround for KT-37302 2020-03-10 10:58:36 +03:00
Victor Petukhov 92a0ddfe71 NI: discard def not null types if they appear in return positions, in inv or in variance
^KT-37343 Fixed
2020-03-08 19:00:27 +03:00
Pavel Kirpichenkov dc42b20ae3 [NI] Use alternative to intersection type in public declarations
The new inference uses inferred intersection types normally, unlike the old inference.
However, intersection types in public declarations are approximated to supertype, which
potentially may give a less presice type, then it would be with the OI.
For non-related T1, T2 the NI approximates {T1 & T2} to Any in public declarations,
and if the OI was inferring T1 instead of the intersection type, it may lead to
less precise declaration type and related errors.

The solution is to remember an alternative for an intersection type when present.
Before approximation the alternative replaces the intersection type.

^KT-36249 Fixed
2020-03-05 20:20:47 +03:00
Vyacheslav Gerasimov bab87c9837 Build: Extract compiler version to separate module to improve caching
Compiler version changes every build and makes impossible to reuse
caches for heavy tasks such as compiler proguard. We may fix that by
adding version module directly to the final jar.
2020-03-05 18:05:53 +03:00
Vyacheslav Gerasimov c2457cae60 Read KotlinCompilerVersion from resource file
Writing build number into a public constant field leads to poor gradle
cache reuse between different builds. Public constant value is a part of
public api and its changes affect inputs of dependent modules.
Extracting build number to resource file allows to ignore it from
runtime classpath which fixes same problem for KotlinCompile tasks
2020-03-05 18:05:53 +03:00
Jinseong Jeon 79790ca227 Avoid uses of plain "kotlin" in metadata deserialization.
KT-35587 Fixed
2020-03-05 02:22:36 +01:00
Georgy Bronnikov 4ea0b4911a Avoid excessive JavaForKotlinOverridePropertyDescriptors
When there are two candidates for a Java method to be interpreted as a
getter for inherited Kotlin property, one from current class, another
from supertype, create just one JavaForKotlinOverridePropertyDescriptor.
Case in point: java.lang.Hashtable.
2020-03-03 20:01:27 +03:00
Vyacheslav Gerasimov a4030d3abf Build: Make JavaExec relative path system independent 2020-03-03 16:47:55 +03:00
Dmitry Petrov 03913ff029 KT-33119 Generate IINC for primitive types only 2020-02-28 23:20:02 +03:00
Abduqodiri Qurbonzoda fe50bb4b93 KProperty and ReadOnlyProperty type parameter names #KT-16529 2020-02-26 17:34:03 +03:00
Roman Artemev bb43a66716 [Metadata] Add platform dependent type transformer
- Fix forward declaration type construction
2020-02-26 14:55:54 +03:00
Denis Zharkov 071149e0fb Fix exception when Java class has different methods with same erasure
^KT-36856 Fixed
2020-02-20 14:06:13 +03:00
Mikhail Zarechenskiy d169435300 Fix construction of Mock classes in case of generic inner types
This fixes testMissingDependencyConflictingLibraries for NI and also
 fixes changed test for OI as well
2020-02-20 12:34:35 +03:00
Mikhail Glukhikh e051251b27 FIR: set isOperator only for Java methods with appropriate names
#KT-35133 Fixed
2020-02-19 18:09:04 +03:00
Denis Zharkov aac72871e7 Fix UI freezes caused by calls with a huge number overloads
While we have an overload resolution algorithm working for O(n^2),
call resolution for the single particular call may work more then just
a second.
Thus, we need to call ProgressManager.checkCanceled() with more granularity

^KT-35135 Fixed
2020-02-18 20:07:14 +03:00
Denis Zharkov 842e2dc02f Optimize retaining most specific methods in LazyJavaScope
See 62a55b7b00
Previously, it was working for O(n^2)
Now, we first group it by jvm descriptor,
then for each groups of size g_i finding the most specific for O(g_i^2)

It should help for the cases when we have a lot of overloads with
different JVM descriptors (modulo return type)
NB: Having the same JVM descriptors is rather rare, because
in Java one cannot generate such a class.

Looks like it's only possible for Scala or some other JVM languages (KT-17560)

It should help a lot for KT-35135
2020-02-18 20:07:13 +03:00
Denis Zharkov d06e35b061 Minor. Reformat overridingUtils.kt 2020-02-18 19:59:56 +03:00
Nikolay Krasko 6c968859ad Access to test root disposable through accessor 2020-02-18 14:13:55 +03:00
Roman Artemev 6a37955a36 [KLIB] Implement new linker based on IdSignature
- Remove klib dependency on metadata and uniqID
 - Refactored proto format to make it more effective and compact
  -- Use special encoding for some types of data (coordinates, flags, types)
  -- Remove symbols table
  -- Use packed proto list if it is possible
 - Remove extension from metadata
 - Remove special ids for function interfaces
 - Fix klib IO
 - Fix incremental cache
 - General code clean up
2020-02-14 18:22:16 +03:00
Roman Artemev df7b7cf61a [K/N] Provide original class id for forward-declared declarataion 2020-02-14 18:22:15 +03:00
Dmitriy Novozhilov e696d1d06a [FIR] Improve mapping arguments to parameters 2020-02-14 17:53:28 +03:00
Yan Zhulanow f4337eede1 Debugger, BE: Support lambda breakpoints for lambdas passed to '@InlineOnly' functions 2020-02-14 17:35:17 +09:00
Mikhail Zarechenskiy c1db9b6d40 [NI] Fix incremental compilation for SAM adapters
This commit fixes test:
 - JavaUsedInKotlin.SamConversions#testMethodAddedSamAdapter
2020-02-13 11:16:00 +03:00
Alexander Udalov c08c3d4d9b Update JVM metadata version to 1.4.0 2020-02-06 17:22:02 +01:00
Will Boyd e27b2990e3 Update message on KotlinReflectionInternalError to reflect that typealiases are also unsupported 2020-01-31 15:58:30 +01:00
Alexander Udalov d4170bca6e Regenerate generated files after updating copyright year 2020-01-30 12:41:42 +01:00
Alexander Udalov 953b461c53 Add new compiler errors and flags when JVM compiles against JVM IR
From now on, the old JVM backend will report an error by default when
compiling against class files produced by the JVM IR backend. This is
needed because we're not yet sure that the ABI generated by JVM IR is
fully correct and do not want to land in a 2-dimensional compatibility
situation where we'll need to consider twice more scenarios when
introducing any breaking change in the language. This is generally OK
since the JVM IR backend is still going to be experimental in 1.4.

However, for purposes of users which _do_ need to compile something with
the old backend against JVM IR, we provide two new compiler flags:
* -Xallow-jvm-ir-dependencies -- allows to suppress the error when
  compiling with the old backend against JVM IR.
* -Xir-binary-with-stable-api -- allows to mark the generated binaries
  as stable, when compiling anything with JVM IR, so that dependent
  modules will compile even with the old backend automatically. In this
  case, the author usually does not care for the generated ABI, or s/he
  ensures that it's consistent with the one expected by the old compiler
  with some external tools.

Internally, this is implemented by storing two new flags in
kotlin.Metadata: one tells if the class file was compiled with the JVM
IR, and another tells if the class file is stable (in case it's compiled
with JVM IR). Implementation is similar to the diagnostic reported by
the pre-release dependency checker.
2020-01-29 17:20:41 +01:00
Mikhael Bogdanov 6c07dbf351 JVM_IR. Support type annotations 2020-01-29 16:59:55 +01:00
Vladimir Dolzhenko 00c71dd098 Clear computable when value is calculated and CallOnceFunction is added
Relates to #KT-35256
2020-01-28 10:50:46 +01:00
Mikhail Zarechenskiy 0530f9ed1c Refactoring: generify and remove duplicated code 2020-01-27 11:03:57 +03:00
Mikhail Zarechenskiy 4e3c27c4ec Refactoring: move SamConversionOracle to core 2020-01-27 11:03:57 +03:00
Mikhail Zarechenskiy 00469712d1 [NI] Don't use only platform specific checks for FIC in inference 2020-01-27 11:03:55 +03:00
Vyacheslav Gerasimov 1f3755248c Build: Make task inputs relative to improve caching 2020-01-24 19:40:00 +03:00
Vyacheslav Gerasimov 760e34aeec Build: Fix type of builtinsJar task
Should be org.gradle.api.tasks.bundling.Jar
2020-01-24 19:39:59 +03:00
Vyacheslav Gerasimov 8dd6a34e17 Build: Make :core:builtins:serialize task cacheable 2020-01-24 19:39:58 +03:00
Alexander Udalov f7321b497b Set KotlinCompilerVersion.IS_PRE_RELEASE = true
Since master is now 1.4-M1, and 1.4 is a pre-release version.
2020-01-24 14:18:51 +01:00
Ilya Gorbunov 8f37ace9ee Finally drop deprecated mod functions from numeric types
#KT-26654
2020-01-23 19:28:22 +03:00
Abduqodiri Qurbonzoda 1203df7405 Deprecate floating point to integral types lesser than Int #KT-30360 2020-01-22 23:27:35 +03:00