Commit Graph

5348 Commits

Author SHA1 Message Date
Ilmir Usmanov 2fedb97d16 Correctly map nullable generic underlying value of inline class
if upper bound is primitive type.
 #KT-32162
2022-02-15 08:11:17 +01:00
Ilmir Usmanov a7e2f7a6b6 Map nullable type parameter with nullable inline class upper bound
which, in turn, has primitive or nullable underlying type to inline
class.
 #KT-32162
2022-02-15 08:11:15 +01:00
Ilmir Usmanov 4f95171472 Minor. Add tests 2022-02-15 08:11:10 +01:00
Vladimir Dolzhenko 4de9de5fc5 Escape special Name used as parameter, custom function names etc
#EA-209929
#KT-51248 Fixed
2022-02-10 21:20:47 +00:00
Dmitriy Novozhilov 0eb526a8b4 [FE 1.0] Report warning about conflict in inherited members from deserialized dependencies
^KT-51194
^KT-51223 Fixed
2022-02-09 19:35:56 +03:00
Ivan Kochurkin 17c64cf955 [FIR] Add INV to UNARY_OPERATION_NAMES, ^KT-50998 Fixed 2022-02-07 17:22:02 +03:00
Dmitriy Novozhilov 52b72a7dac [FIR] Implement Int -> Long conversions for literals and operators over them
^KT-38895
^KT-50996 Fixed
^KT-51000 Fixed
^KT-51003 Fixed
^KT-51018 Fixed
2022-02-07 13:36:36 +03:00
Steven Schäfer 78d80181e2 inlineClassUtils: Fix handling of inline classes without constructors
Fixes KT-50992

DeclarationDescriptor.isInlineClass misidentifies inline classes without
constructors. This can happen for the ABI of inline classes with private
constructors.
2022-02-04 23:30:24 +01:00
Pavel Kirpichenkov 4eb2c2f6f1 Minor: reformat 2022-02-04 16:57:22 +03:00
Pavel Kirpichenkov 0362d4ac9f [MPP] workaround inc/dec operator checks in expect classes
Implicit receiver type inside expect class is inconsistent with the
type resolved from an explicit reference inside that class. The former
one is a default class type, i.e. expect; the latter one resolves to
an actual type when either expect and actual are in the same module, or
when the sources are compiled for a particular platform.

The workaround is to manually actualize implicit receiver type for one
particular check affected by the broken subtyping.

KT-49714
2022-02-04 16:57:22 +03:00
Mikhail Glukhikh c255da815f Change some names in source code from useExperimental to optIn 2022-01-27 11:48:21 +00:00
Ivan Kochurkin defb0cf611 [FIR] Fix ambiguity between Sequence.forEach and Iterable.forEach (with @HidesMembers) ^KT-50776 Fixed 2022-01-21 19:34:10 +03:00
Dmitriy Novozhilov 17916d4a63 [FE] Return Name? instead of List<Name> from getBuiltinFunctionNamesByJvmName
This is much more correct, because we have one to one mapping for
  special java functions in this case, so using single nullable name
  instead of list of names makes code more readable
2022-01-19 15:24:43 +03:00
Mikhail Glukhikh d0fa3eb1d3 Forbid ExtensionFunctionType on functional types without parameters
#KT-43527 Fixed
2022-01-14 22:20:24 +03:00
Evgeniy.Zhelenskiy e97ca2ada4 [Psi2Ir, Fir2Ir] Generate toString, hashCode, equals methods for MF VC 2022-01-14 13:51:57 +00:00
Evgeniy.Zhelenskiy c7edc353d3 [FIX, Frontend] Fix recursive check for multi-field value classes 2022-01-14 13:51:57 +00:00
Evgeniy.Zhelenskiy e69a973b07 [Frontend, Ir] Equality test passes 2022-01-14 13:51:57 +00:00
Dmitriy Novozhilov e9ac24dc33 [FE 1.0] Report errors on cycles in annotation parameter types
^KT-47932
^KT-50753 Fixed
2022-01-14 14:26:52 +03:00
Stanislav Erokhin 1326ca674e Introduced IDEAPluginsCompatibilityAPI and returned some API
Please read the description of IDEAPluginsCompatibilityAPI.
Also, you may notice, that Deprecation annotation was removed.
That is because with level ERROR it isn't possible to opt-in
to such API in the legit cases. And with level WARNING it won't be
reported because We have diagnostic with level ERROR about OptIn marker.
Sadly, there is no way to add ReplaceWith to the OptIn marker
2022-01-13 18:03:07 +01:00
Denis.Zharkov a33d9df0cd NI: Support forking inference with heuristics
Mostly, it only affects FIR

It partially allows to consider several variance of constraints like
A<Int> & A<T> <: A<X_var> that are mostly brought by smart casts

^KT-49542 Fixed
^KT-50489 Relates
2022-01-11 20:45:55 +03:00
Victor Petukhov 455b3143e7 [FE 1.0] Introduce builder inference stub types checker which may report more precise and clear errors due to resolution ambiguity
^KT-49828 Fixed
2022-01-11 18:34:47 +03:00
Victor Petukhov 8e2b90b5db [FE 1.0] Don't report CAST_NEVER_SUCCEEDS on stub types
^KT-49829 Fixed
2022-01-11 18:34:41 +03:00
Irene Dea 76b7cb3193 Fix hasCustomAttributes 2022-01-08 15:26:44 +03:00
Irene Dea 13bff10567 Fix union related failures. 2022-01-08 15:26:44 +03:00
Irene Dea a98e2c4e03 Fix failed tests 2022-01-08 15:26:44 +03:00
Irene Dea 3c4989b672 Address JDK8/JDK6 issues with computeIfAbsent 2022-01-08 15:26:44 +03:00
Irene Dea 374d287d08 Reorganize TypeAttributeTranslatorExtension 2022-01-08 15:26:38 +03:00
Irene Dea 19bfc43bee Fixes and refactors 2022-01-08 15:25:07 +03:00
Irene Dea 2e2e70fede Translate attributes in TypeDeserializer 2022-01-08 15:25:07 +03:00
Irene Dea d444978ebf Add support for attribute serialization. 2022-01-08 15:25:07 +03:00
Irene Dea f2a351367c Implement unionTypeAttributes and replaceTypeAttributes in ConeInferenceContext 2022-01-08 15:25:07 +03:00
Irene Dea 56d817b49f Union type attributes for common super type calculation 2022-01-08 15:25:07 +03:00
Irene Dea db471ca61e Intersect attributes for intersection types 2022-01-08 15:25:07 +03:00
Irene Dea fad3c1f2f6 Add initial type attributes infra 2022-01-08 15:25:06 +03:00
Irene Dea 62bde2d686 Move AttributeArray to compiler.common so frontend extension can share it 2022-01-08 15:25:06 +03:00
Igor Laevsky a5ebd3c716 Re-generate built-ins 2022-01-01 21:46:55 +02:00
Alexander Udalov 92c80873ba Revert "JVM: remove support for disabling NoConstantValueAttributeForNonConstVals"
This is a partial revert of e857966edb.

Specifically, behavior is restored in the old backend, which will allow
to support language version 1.3, where this language feature was not
enabled yet. There are no changes in the JVM IR backend, because to
enable JVM IR with LV 1.3, you need to pass the compiler argument
`-Xuse-ir` which is not stable and we don't guarantee anything about it.

 #KT-50251
2021-12-28 13:21:18 +01:00
Victor Petukhov 29f174f074 Revert "Revert "Temporary workaround for failing tests on teamcity.""
This reverts commit 2c51799e0a.
2021-12-27 22:56:01 +03:00
Ilya Kirillov 78db89b46b Extract AbstractBinaryClassAnnotationLoader to be used without FE1.0 2021-12-27 16:23:08 +03:00
Ilya Kirillov 25fe14b514 Move PerformanceCounter to runtime utils, so it can be used outside FE1.0 2021-12-27 16:23:07 +03:00
Ilya Kirillov 3686fc109d Extract AnnotationLoader from AnnotationAndConstantLoader, so it can be used without FE1.0 2021-12-27 16:23:07 +03:00
Ilya Kirillov 49e9c47071 Move DynamicTypeDeserializer.id from IR module to common module
So, it can be used from cls-psi-stub-builder module
2021-12-27 16:23:06 +03:00
Victor Petukhov 2c51799e0a Revert "Temporary workaround for failing tests on teamcity."
This reverts commit 2436ca3d8b.
2021-12-23 13:42:56 +03:00
Alexander Udalov 56fe62b7fb Reflection: don't use Annotation.equals where identity equals works
In KT-50198, Spock generates a method named `$spock_feature_0_0` which
is annotated with `org.spockframework.runtime.model.FeatureMetadata`.
The problem is that for some reason (probably a bug in Spock or some
kind of version mismatch), this annotation lacks value for the method
`dataVariableNames`, which has no default value.

If an annotation lacks a non-default value, it's OK for the JVM, but not
OK for Java reflection. Specifically, `Annotation.equals` for annotation
proxy classes created at runtime checks that values are equal for each
annotation method. If there's no value for some annotation method
without a default value, it fails with NPE.

kotlin-reflect used `Annotation.equals` in `ReflectJavaAnnotation`,
however there was no intention to perform structural equals on
annotations; equals/hashCode were implemented only to make stuff like
`LazyJavaAnnotations.annotationDescriptors` work, which is a hash map
where `JavaAnnotation` (`ReflectJavaAnnotation` in kotlin-reflect) is
the key.

This commit changes equals/hashCode to use identity instead, since this
is cheaper, and safer because of cases like the one described above.
This is also consistent with other implementations, e.g. PSI-based
`JavaAnnotationImpl` which naturally checks if the underlying PSI
elements are the same, without any kind of structural equality.

I'm not entirely sure why this appeared as a regression in 1.5.30, but
the most likely candidate is the signature enhancement refactoring,
after which we (supposedly) started to load more annotations on
declarations coming from Java, just in case they are annotated with some
nullability annotations.

No test added because to replicate the issue, we basically need to
generate an incorrect annotation proxy class _at runtime_, which is
difficult.

 #KT-50198 Fixed
2021-12-22 22:20:20 +01:00
Stanislav Erokhin 2436ca3d8b Temporary workaround for failing tests on teamcity.
This commit should be reverted later with testdata update
2021-12-22 18:51:20 +01:00
sebastian.sellmair 6268852b7a [MPP] Set .isExpect when deserializing a ClassConstructorDescriptor
This will fix expect/actual matching for class constructors
when dependsOn modules are deserialized.

^KT-50120 Verification Pending
2021-12-21 21:31:43 +00:00
Dmitriy Novozhilov d9a3dd09ea [FE 1.0] Save ModuleDescriptor in CompileTimeConstant 2021-12-21 16:36:18 +03:00
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Vyacheslav Gerasimov bc2f0936bd Build: Rename commonDep -> commonDependency 2021-12-16 21:48:19 +03:00
Victor Petukhov b3943f5ab6 [FE 1.0] Process builder inference stub types with different nullability properly
^KT-49887 Fixed
2021-12-15 22:23:18 +03:00