Commit Graph

182 Commits

Author SHA1 Message Date
Mikhail Bogdanov 9c0b96af71 Report error on missed specialization in compatibility mode
#KT-39603 Fixed
2020-06-19 11:57:36 +02:00
Alexander Udalov fc1217ba07 Generate delegates to DefaultImpls in fun interface wrappers
#KT-37436 Fixed
2020-06-09 11:44:31 +02:00
Jinseong Jeon bcf277d885 Add comments for generators about data/inline class (in psi2ir and fir2ir) and annotations (fir2ir). 2020-05-14 09:41:11 +03:00
Dmitriy Dolovov 90e888a1b6 Discriminate overloading expect MemberDescriptors
Issue #KT-38298
2020-04-28 13:16:18 +07:00
Dmitry Petrov 24b8495e00 KT-30419 Box inline classes in return types of covariant overrides
Use boxed version of an inline class in return type position for
covariant and generic-specialized overrides.

Also fixes KT-35234 and KT-31585.
2020-04-01 22:59:14 +03:00
Alexander Udalov a4cc5ea1da Remove unneeded dependency of backend-common on ir.tree 2020-02-05 22:45:12 +01:00
Alexander Udalov 2552540f71 IR: wrap exceptions and add file path in per-file lowerings
Also add file path to the wrapped exception in JVM IR codegen
2019-12-03 11:06:54 +01:00
Vladimir Dolzhenko 10ea8abc2b Wrap file.declarations with runReadAction
#EA-209932 Fixed
2019-10-21 17:18:04 +02:00
Denis Zharkov 67410f7a57 Parametrize behavior of DescriptorEquivalenceForOverrides::areCallableDescriptorsEquivalent
The changes introduced 471134d31e are only needed
for the case of HMPP project while for other cases it might break the behavior
a bit like in KT-34027

See org.jetbrains.kotlin.resolve.calls.results.OverloadingConflictResolver#filterOutEquivalentCalls

Before 471134d we were comparing
"fun foo(x: String)" with "[substituted] fun foo(x: String)"
and areCallableDescriptorsEquivalent returned false for such case.
Thus, both overrides were left in the resulting set.

After 471134d, those two descriptors
becamed considered as equal thus having a possibility to remove any of them.

The problem is that "areCallableDescriptorsEquivalent" has kind of
unclear contract. Effectively it checks whether two descriptors match
to the same declaration

But straightforward fixing of this exact call-site (using original descriptors)
doesn't help: behavior might change in a very subtle way (see org.jetbrains.kotlin.spec.checkers.DiagnosticsTestSpecGenerated.NotLinked.Dfa.Pos#test72)

So, the main idea is changing the contract for areCallableDescriptorsEquivalent
only when project is HMPP one.

^KT-34027 In Progress
2019-09-30 20:09:42 +03:00
Yan Zhulanow ae7550c5af Move out JVM debugger functionality 2019-05-30 15:27:07 +09:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Alexander Udalov 4b712bd14b Remove dependency of backend-common on descriptors.jvm 2019-03-05 16:28:34 +01:00
Alexander Udalov 3d1858a8c5 Refactor and rename CodegenUtil.getDeclarationsToGenerate
Move logic regarding expect classes to the only relevant call site at
PackageCodegenImpl, and return the list of members to remove code
duplication at remaining call sites
2019-02-19 16:37:46 +01:00
Mikhael Bogdanov a122cba862 Switch Kotlin project to jvm-target 1.8
#KT-29405
2019-01-31 07:43:05 +01:00
Sergey Rostov f35185b261 Build: remove explicit dependencies to org.jetbrains.annotations 2019-01-28 13:43:08 +03:00
Denis Zharkov 5ec93f2718 Avoid assertion in bridges-generation for light classes
^KT-11656
2019-01-14 14:54:18 +03:00
Denis Zharkov e0ff7281b4 Minor. Introduce FunctionHandle::mightBeIncorrectCode 2019-01-14 14:54:18 +03:00
Denis Zharkov 949214c10b Refactor bridges generation for JVM
Make a separate subclass for DescriptorBasedFunctionHandle
to allow customize the behavior without complex abstract concepts
like `areDeclarationAndDefinitionSame`
2019-01-14 14:54:18 +03:00
Denis Zharkov 5cc242e878 Refactor FunctionHandle::isInterfaceDeclaration
- Give it more clear name mayBeUsedAsSuperImplementation
  because defining if it can be used as super-implementation
  this is what it used for
- The meaning is negated, so it's needed to negate its usages and impls
- Also, reuse it in findSuperImplementationForStubDelegation
2019-01-14 14:54:18 +03:00
Sergey Rostov 883970fadb Add explicit dependencies to nullable annotations 2018-12-26 09:07:06 +03:00
Ilmir Usmanov 9af7316845 Add call checker to report error more granulary if possible
This, however, works only for calls of 'synchronized' only. Thus, it
does not support inline functions of any kind.
2018-10-09 22:55:51 +03:00
Alexander Udalov 3ca81b95c2 Use non-allowed actual defaults in backends to workaround compiler exception
It's difficult to fix KT-22818 until the IR comes along, so we're
providing a workaround where one can disable the
ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS error and provide default values
in the actual function, to avoid exception from the backend.

 #KT-22818
2018-09-21 17:30:05 +03:00
Mikhael Bogdanov 92ce50b22c JVM_IR. Cache defaultImpls function declarations 2018-08-31 15:34:18 +03:00
Anton Bannykh 934e11aa60 JS: support unsigned primitive vararg's 2018-08-30 14:57:20 +03:00
Mikhail Zarechenskiy c253b39acf Refactoring: extract generator for functions from Any 2018-08-06 10:19:46 +03:00
Ilmir Usmanov 4811757d8d Disable intercepted instrinsic in 1.3
Fix compiler bootstrapping.
2018-07-17 22:25:43 +03:00
Pavel V. Talanov 770c280ba5 Light classes: handle broken context in case of supertype delegation
This lead to an exception being thrown frequently
Proper fix would be to prevent binding context from being corrupted
Known cases are hard to debug/reproduce

 #EA-101081 Fixed
2018-07-17 17:37:20 +02:00
Ilmir Usmanov bc4a7aec76 Remove suspendCoroutineOrReturn intrinsic from compiler
#KT-21240: Fixed

Also, change logic of intrinsics check.

 #KT-23438: Fixed
2018-07-16 15:09:18 +03:00
Denis Zharkov 170086250b Support new Continuation API in JVM BE
#KT-24863 Fixed
2018-07-09 15:27:19 +03:00
Dmitry Petrov 353076f596 compiler/ir/backend.common is NOT a part of compiler/backend-common 2018-06-29 11:24:46 +03:00
Alexander Udalov 1951d38f40 Retain optional expected annotations when compiling platform code
After this change, optional expected annotations will be compiled to
physical class files on JVM, and stored to metadata on other platforms,
to allow their usages from dependent platform modules. For example:

    @OptionalExpectation
    expect annotation class A

When compiling this code on JVM, A.class will be produced as if the
class A did neither have the 'expect' modifier, nor had it been
annotated with OptionalExpectation. Note that if there's no actual
annotation class for A, then usages (which can only be usages as
annotation entries) are simply skipped.

Class A will be public from Kotlin's point of view (since it should
be possible to use it in Kotlin sources), but _package-private_ in Java
to disallow its usages outside of the declaring module.

 #KT-18882 Fixed
 #KT-24617 Fixed
2018-06-26 10:23:55 +02:00
Alexander Udalov 4e217b180a Pass BindingContext to CodegenUtil.getActualDeclarations
Will be used in a subsequent commit. Also rename getActualDeclarations
-> getDeclarationsToGenerate
2018-06-26 10:23:55 +02:00
Mikhael Bogdanov e58e05f9be Minor. Reformat 2018-06-04 10:49:57 +02:00
Denis Vnukov e3829a70b0 Stable order of synthesized bridges.
In some cases when several bridge methods are generated, their order
is undetermenistic. For example for class ClassLowerWithContext in the
following example

```
interface IrElement
class IrClassContext

interface IrElementVisitor<out R, in D> {
    fun visitElement(element: IrElement, data: D): R
}

interface IrElementTransformer<in D> : IrElementVisitor<IrElement, D> {
    override fun visitElement(element: IrElement, data: D): IrElement =
            element.also { throw RuntimeException() }
}

abstract class ClassLowerWithContext : IrElementTransformer<IrClassContext?>
```

kotlin compiler synthesizes two additional bridges:

  public IrElement visitElement(IrElement, IrClassContext);
  [bridge] public Object visitElement(IrElement, Object);
  [bridge] public IrElement visitElement(IrElement, Object);

Unfortunately the behavior is not deterministic and not easy to reproduce.
2018-04-18 15:36:33 +02:00
Ilmir Usmanov 2cfe387bab Move coroutines to kotlin.coroutines package: compiler
Generate continuation type as kotlin.coroutines.Continuaion. This code will
fail at runtime since there is no stdlib backing this change yet.
However, in order to generate compatible stdlib we need a compiler, which
generates continuation type as kotlin.coroutines.Continuation.
Thus, firstly we support the change in the compiler, make it bootstrap
compiler and only then change stdlib and tests accordingly.
 #KT-23362
2018-04-10 22:51:46 +03:00
Mikhael Bogdanov 2a8041e77e Check method abstractness during bridge generation per method not interface 2018-04-03 19:18:14 +02:00
Alexey Tsvetkov 8a82c1618c Use Plugins DSL in Kotlin Gradle scripts
When plugins DSL is used, there is no need to
manually generate typesafe accessors for extensions and
conventions (by running `./gradlew kotlinDslAccessorsSnapshot`).
2018-03-26 16:09:29 +03:00
Yan Zhulanow 34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00
Ilmir Usmanov 87bbac9d43 Take coroutineContext into account in RedundantSuspendModifierInspection
#KT-22651: Fixed
2018-02-08 19:34:20 +03:00
Alexander Udalov 80a7f92309 Extract logic to get function parameters for default value generation
For some reason, this logic was a bit different in JVM (FunctionCodegen)
and JS (FunctionBodyTranslator). For example, in JS the
EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND diagnostic was
reported even in the case when no expected function was found for the
actual function at all, which made it quite difficult to write
multiplatform sources for JS stdlib where it both should be compiled as
a part of the multiplatform project, and by itself (suppressing
NO_ACTUAL_FOR_EXPECT): in the latter case, the new error must have been
suppressed everywhere as well

 #KT-21913
2018-02-08 14:14:10 +01:00
Alexander Udalov db4ce703a6 Support default arguments for expected declarations
#KT-21913 Fixed
2018-02-05 13:38:05 +01:00
Ilmir Usmanov 8ffb205f1c Reformat coroutineContext related code 2018-02-01 13:18:43 +03:00
Ilmir Usmanov 18c03f94f8 Move coroutineContext to correct package
from kotlin.coroutines.experimental.instrinsics to kotlin.coroutines.experimental

 #KT-22400
2018-02-01 13:18:32 +03:00
Ilya Chernikov 4eb557724c Convert compiler projects to the new intellij deps 2018-01-30 17:06:13 +03:00
Ilya Chernikov a4f28cd94f Make all dependencies to idea sdk intransitive 2018-01-30 17:06:11 +03:00
Ilmir Usmanov 0fbbe10143 Support suspendCoroutineUninterceptedOrReturn intrinsic
KT-17336: Fixed
2017-11-20 18:12:41 +03:00
Alexey Andreev 7b403211dd JS: kotlinize WhenTranslator 2017-11-17 11:07:37 +03:00
Mikhael Bogdanov cbfcb74b58 Get rid of cli dependencies from ir 2017-11-16 14:46:53 +01:00
Alexander Udalov 02981038f3 Split core into descriptors, descriptors.jvm, deserialization, descriptors.runtime 2017-11-10 18:58:31 +01:00
Ilmir Usmanov 817f79520a Implement coroutineContext intrinsic
This intrinsic allows coroutine to access its context without suspention
and, furthermore, disabling tail-call optimization.
KT-17609: Fixed
2017-11-02 12:45:24 +03:00