Commit Graph

3167 Commits

Author SHA1 Message Date
Denis Zharkov 0e132b9857 Move all coroutine-related declarations from built-ins to stdlib
Also move internal declarations from runtime.jvm module into new package
kotlin.coroutines.jvm.internal in stdlib

The necessity of these declarations being in built-ins is controversial,
but also it will complicate the migration of current coroutine runtime
to a separate jar if we ever need this
2017-01-27 23:24:13 +03:00
Zalim Bashorov 66fd566df0 KJS: fix inlining from modules with non valid identifier name 2017-01-27 23:13:53 +03:00
Zalim Bashorov 487419e762 KJS: don't export inline functions with InlineOnly annotation and inline functions with reified generic parameter 2017-01-27 22:47:10 +03:00
Alexey Andreev 4c831cab9e JS: regenerate stdlib files from IDL 2017-01-27 20:54:43 +03:00
Alexey Andreev 04e9405082 JS: regenerate stdlib files from IDL 2017-01-27 20:54:42 +03:00
Alexey Andreev 563a3a25cb JS: add Promise class 2017-01-27 20:54:41 +03:00
Mikhael Bogdanov ab464ea86e Fix for KT-15726: Kotlin can't compile nested try-catch with return
#KT-15726 Fixed
2017-01-27 14:09:13 +01:00
Ilya Gorbunov 01f53d0173 Return NaN as an average of an empty collection.
#KT-15399 Fixed
2017-01-27 14:53:33 +03:00
Ilya Gorbunov 661ff81e67 Specify names for parameters of functional types with two or more parameters to ease lambda completion.
#KT-13826
2017-01-27 14:46:29 +03:00
Dmitry Petrov e05f2eaff6 KT-15017 Throwing exception in the end of inline suspend-functions lead to internal compiler error
Suspend function call with a reachable (alive) begin marker and unreachable (dead) end marker
is an exit point for the corresponding coroutine.
It isn't a suspension point, and doesn't introduce a new state in the coroutine FSM.
2017-01-27 10:43:00 +03:00
Ilya Gorbunov 3be1174824 Replace @native with external in tests 2017-01-27 01:29:15 +03:00
Ilya Gorbunov 20f175d091 Soften back deprecation level for nativeGetter/Setter/Invoke annotations. 2017-01-27 00:48:46 +03:00
Dmitry Petrov 1613ad0505 KT-15898 Cannot use type alias to qualify enum entry
Type alias static scope includes enum entries for underlying enum class.
2017-01-26 10:23:56 +03:00
Dmitry Petrov ab2448307e Functions imported from objects should be properly mapped to "real" suspend function descriptors. 2017-01-26 09:39:53 +03:00
Ilya Gorbunov c00d684ece Fix deprecared API usages in test 2017-01-26 04:31:20 +03:00
Ilya Gorbunov 288e0b3c7e Allow to use Regex matches CharSequence and CharSequence matches Regex in infix form
#KT-14279
2017-01-25 21:31:42 +03:00
Ilya Gorbunov 387564d140 JS: Rewrite RegExpMatch without @nativeGetter 2017-01-25 21:29:53 +03:00
Ilya Gorbunov 03019dc638 Deprecate qunit (with ERROR) and jquery (with WARNING) 2017-01-25 21:29:53 +03:00
Ilya Gorbunov 70f3cee9ff Harden deprecations to prepare for cleanup. 2017-01-25 21:29:53 +03:00
Ilya Gorbunov 1ccc655cdc Harden deprecation level on remaining API in java.util in kotlin-stdlib-js 2017-01-25 21:29:53 +03:00
Dmitry Jemerov 9bc45a9c91 Correctly dispose KotlinCoreEnvironment after use 2017-01-25 17:30:10 +01:00
Alexey Andreev 1c8478e46b JS: fix translation of enum entries without parentheses that call secondary constructors, constructors with default parameters and varargs. See KT-15900, KT-14097 2017-01-25 18:09:23 +03:00
Alexey Andreev 31c758994d JS: remove diagnostic about callable reference to built-in 2017-01-25 18:09:22 +03:00
Alexey Andreev ad4fb44827 JS: report about using of external interfaces in class literals 2017-01-25 18:09:22 +03:00
Alexey Andreev deaac83e70 JS: report about wrong module usage in class literals. See KT-15253 2017-01-25 18:09:21 +03:00
Alexey Andreev 9000d54d8a JS: when checking calls to JsModule declarations, check arguments passed to reified type parameters. See KT-15253 2017-01-25 18:09:20 +03:00
Alexey Andreev e15b2b0dd0 Fix compilation of project 2017-01-25 14:15:23 +03:00
Denis Zharkov 9ce3880ac6 Support getValue/setValue/provideDelegate suspend functions in JVM backend
- Determine if there are non-tail calls to getValue/setValue simply
by existance of such a property
(it might be too strict, but implementing more granular check may be rather hard)

- Change in ExpressionCodegen is relevant for provideDelegate,
that in case of local variables uses OnStack as StackValue
(see the comment near these changes)

 #KT-15933 Fixed
2017-01-25 13:54:01 +03:00
Denis Zharkov 9ca9a988a6 Fix accessor generation for suspend functions
1. JVM view of suspend accessors must be also an instance of AccessorForFunctionDescriptor,
thus `createSubstitutedCopy` should be correctly overidden.

2. accessibleFunctionDescriptor should unwap the initial suspend descriptor,
for the same reasons as for type aliases constructors and etc:
these descriptors are used as keys of the map of accessors, so
to avoid duplication for suspend view and initial suspend descriptor,
we always use the latter one as a key.

 #KT-15907 Fixed
 #KT-15935 Fixed
2017-01-25 13:54:01 +03:00
Denis Zharkov 0693bd6b62 Fix codegen issue on suspend functions with receiver
When the extension receiver of a named suspend function was marked as used
from the inner lambda, codegen used to throw a "Don't know how to generate outer expression for class" exception.

It may seem quite tricky, but currently for suspend lambda body
its extension receiver is treated as it's defined inside the relevant "doResume"
(there is an actual bytecode part that fills the relevant local variable)

The problem was that inside ExpressionCodegen for "doResume" of named
suspend function we couldn't determine that original function has
an extension receiver.

 #KT-15821 Fixed
 #KT-15820 Fixed
2017-01-25 13:54:01 +03:00
Denis Zharkov 02b40326cc Fix incorrect coroutines codegen behavior
If all the suspension calls in a suspend function were "hidden"
under the for-convention (iterator/next/hasNext) calls,
control-flow didn't find them, thus supposing that there is no
suspension points and there is no need to generate a coroutine state machine

The solution is to add relevant calls to CFG

 #KT-15824 Fixed
2017-01-25 13:54:01 +03:00
Alexey Andreev 8cbea903f4 JS: add checker that checks if JsQualifier has wrong format 2017-01-25 13:52:19 +03:00
Alexey Andreev ba65e58fdd JS: add checker to detect non-external declarations in files marked by JsModule or JsQualifier annotation 2017-01-25 13:52:19 +03:00
Alexey Andreev cc67f6c9f7 JS: add support of JsQualifier annotation. See KT-15905 2017-01-25 13:52:18 +03:00
Alexey Andreev 6624736ccf JS: fix is check on Throwable instances 2017-01-25 13:52:18 +03:00
Alexey Andreev aef7b83932 JS: fix toString in case of kotlin.Throwable 2017-01-25 13:52:17 +03:00
Alexey Andreev 6b2f1ba4e4 JS: move couple of helper functions from TranslationUtils to JsDescriptorUtils 2017-01-25 13:52:17 +03:00
Alexey Andreev 115f6ced87 JS: fix support of throwable constructors without message and/or cause parameters 2017-01-25 13:52:16 +03:00
Alexey Andreev 6f4d8decc7 JS: add support of custom exceptions inherited from kotlin.Throwable that call super constructor from secondary constructor 2017-01-25 13:52:16 +03:00
Alexey Andreev f34093db9f JS: make kotlin.Throwable = Error. See KT-15312 2017-01-25 13:52:13 +03:00
Alexey Andreev c565697e77 JS: refactor FunctionIntrinsic 2017-01-25 13:51:54 +03:00
Alexey Andreev 0a9c536c01 JS: make defensive copy of argument list in JsInvocation and JsNew constructor 2017-01-25 13:51:53 +03:00
Alexey Andreev 51e5b5aac7 JS: allow to inherit external class from kotlin.Throwable. See KT-15336 2017-01-25 13:51:53 +03:00
Anton Bannykh 847ec9e550 JS: fixed subSequence in CharSequence descendants (KT-14035) + added support for function intrics in delegation 2017-01-25 12:59:53 +03:00
Ilya Gorbunov 8e9bbe276c JS: Make Date.getTime return Double instead of Int.
#KT-4141 Fixed
2017-01-24 21:55:48 +03:00
Alexey Andreev 46d251df1b JS: deprecate noImpl 2017-01-24 20:18:42 +03:00
Alexey Andreev 5243b451f7 JS: replace noImpl with definedExternally in hand-written stdlib 2017-01-24 20:18:42 +03:00
Alexey Andreev c05870b461 JS: regenerate stdlib 2017-01-24 20:15:22 +03:00
Alexey Andreev c9a190b405 JS: regenerate stdlib sources from IDL 2017-01-24 20:15:19 +03:00
Alexey Andreev 26abc19aa6 JS: replace noImpl with definedExternally in diagnostics and their messages 2017-01-24 20:14:32 +03:00