Commit Graph

4170 Commits

Author SHA1 Message Date
Alexander Udalov b5007c417d Minor, restructure reflection tests a little
To allow their usage in https://github.com/udalov/kotlin-obfuscation-test-app
2018-05-30 13:03:10 +02:00
Roman Artemev 06009a532b Add test case to detect name clash in stdlib-js 2018-05-29 13:57:34 +03:00
Anton Bannykh 03e46ce0ca JS: more default arguments fixes (KT-24413, KT-21968 fixed)
MPP-related:
* inherited from interfaces
* inherited body from interface
* default arguments in an interface, implemented by a class delegate
* super call of a method with default argument

Also:
* inheritance from an interface and another interface descendant (KT-21968)
* inheritance through an intermediate interface
2018-05-28 15:27:21 +03:00
Roman Artemev 84447d59e1 [JS IR BE] Update test data 2018-05-24 21:07:25 +03:00
Roman Artemev de9aea6e98 [JS BE] Fix delegation of suspend method member (KT-23094) 2018-05-23 14:59:59 +03:00
Roman Artemev 8862b26bbd Add test case to check delegation of suspend method 2018-05-23 14:59:59 +03:00
Alexander Udalov e7f6ac1e50 Fix data class equals codegen for type parameters with interface bounds
#KT-24474 Fixed
2018-05-22 13:45:21 +02:00
Ilmir Usmanov f568149863 Implement new assert semantics in back-end
Previously, assert was just a regular function and its argument used to
be computed on each call (even if assertions are disabled on JVM).
This change adds support for 3 new behaviours of assert:
* always-enable (independently from -ea on JVM)
* always-disable (independently from -ea JVM)
* runtime/jvm (compile the calls like javac generates assert-operator)
* legacy (leave current eager semantics) - this already existed

Default behaviour is legacy for now.

The behavior is changed based on -Xassertions flag.
 #KT-7540: Fixed
2018-05-21 20:43:37 +03:00
Dmitry Savvinov c33b7377da Add support of internal arguments for language feature settings
Arguments are passed in form '-XXLanguage:+LanguageFeatureName' for enabling
LanguageFeature.LanguageFeatureName, and '-XXLanguage:-LanguageFeatureName'
for disabling.

Note that they do override other settings, including 'language-version'
or extra ('-X') args.
2018-05-18 16:16:23 +03:00
Roman Artemev c9b8aadfff Update test data 2018-05-11 18:50:41 +03:00
Roman Artemev 24e477c378 Update test data 2018-05-11 17:14:30 +03:00
Roman Artemev d71ff1818d Add test 2018-05-11 11:33:23 +03:00
Roman Artemev 4f2d5baa5d [KT-24335]
Fix inheritance from interface which is also inherited from an external interface
Add test case
2018-05-11 11:26:34 +03:00
Anton Bannykh 23fb5107c7 JS: fix Long inlining (private, companion) (KT-24189 fixed). 2018-05-10 21:06:50 +03:00
Mikhail Zarechenskiy b25a1d9522 Support inline functions inside inline classes 2018-05-07 15:25:46 +03:00
Mikhail Zarechenskiy 5c57c799fc Fix generation of elvis with null constant for inline classes 2018-05-07 15:25:45 +03:00
Ilmir Usmanov 5e4ce4f880 Remove coroutineContext from kotlin.coroutines.experimental.intrinsics package
#KT-22400: Fixed
2018-05-07 10:28:54 +03:00
Mikhail Zarechenskiy b23e9f771b [NI] Fix checking for the same instance inside for suspend functions 2018-05-04 19:53:54 +03:00
Alexander Udalov 10da41b136 Regenerate tests 2018-04-30 18:51:28 +02:00
Alexander Udalov c63cd430d1 Fix no-arg constructor generation for actual class 2018-04-30 15:26:50 +02:00
Denis Zharkov 0788afe92c Avoid computing AST for IdentifierChecker
Basically, it's unnecessary to check anything when analysing stubs,
but it's complicated now to avoid that, so we just postpone
computing AST until reporting happens
2018-04-28 17:12:52 +03:00
Roman Artemev d9fdddceb9 Update test data 2018-04-27 20:02:59 +03:00
Roman Artemev 997328f584 Refactoring and fixes 2018-04-27 20:00:40 +03:00
Roman Artemev ed0c26ef07 Implement function literals in JS BE 2018-04-27 19:53:47 +03:00
Zalim Bashorov 5c40892c57 [JS IR BE] Right support for inc and dec on primitive numbers 2018-04-26 13:46:50 +03:00
Zalim Bashorov 27988cd2f4 Remove the version of fail.kt that was "hacked" for JS IR BE tests 2018-04-25 22:21:22 +03:00
Zalim Bashorov 34587d9192 [JS IR BE] unmute tests 2018-04-25 22:20:43 +03:00
Zalim Bashorov 8d89a93c44 [IR JS BE] Add core.kt to list of compiling files for JS IR BE tests 2018-04-25 22:18:58 +03:00
Roman Artemev 61e051cafa Update test data 2018-04-24 14:04:16 +03:00
Roman Artemev ec57a335f7 Temporally hacked js assert to make depending tests work 2018-04-24 13:52:16 +03:00
Ilmir Usmanov f60787d57c Move coroutines to kotlin.coroutines package: tests
Introduce COMMON_COROUTINES_TEST directive.
Every test with this directive is run twice: one time with
language version 1.2 and kotlin.coroutines.experimental package
and the other time with language version 1.3 and kotlin.coroutines
package. Each run is a separate method: with suffixes _1_2 and _1_3
respectively.
However, since codegen of release coroutines is not supported in JS
backend, we generate only one method: with suffix _1_2.
 #KT-23362
2018-04-23 21:51:59 +03:00
Alexander Udalov 965e3ebab2 Do not serialize SOURCE-retained annotations
Also, fix the value of "hasAnnotations" flag to reflect if there are any
_non-source_ annotations on a declaration.

Unfortunately, after this change
IncrementalJsCompilerRunnerTestGenerated$PureKotlin.testAnnotations
starts to fail because of the following problem. The problem is that
annotations on property accessors are not serialized yet on JS (see
KT-14529), yet property proto message has setterFlags field which has
the hasAnnotations flag. Upon the full rebuild of the code in that test,
we correctly write hasAnnotations = true, but annotations themselves are
not serialized. After an incremental build, we deserialize property
setter descriptor, observe its Annotations object which happens to be an
instance of NonEmptyDeserializedAnnotationsWithPossibleTargets. Now,
because annotations itself are not serialized, that Annotations object
has no annotations, yet its isEmpty always returns false (see the code).
Everything worked correctly before the change because in
DescriptorSerializer.hasAnnotations, we used Annotations.isEmpty and the
result was the same in the full rebuild and in the incremental scenario.
But now we're actually loading annotations, to determine their
retention, and that's why the setterFlags are becoming different here
and the test fails

 #KT-23360 Fixed
2018-04-23 18:42:33 +02:00
Dmitry Petrov 1eca402332 Use correctElementType to determine array element type for withIndex
Rather unkind "gotcha" in ASM API.

 #KT-23900 Fixed Target versions 1.2.50
2018-04-23 18:00:12 +03:00
Dmitry Petrov 22c2d8b563 Introduce a separate StackValue class for lateinit local vars
Local lateinit var differs in behavior from a simple local var,
and logic that relies of 'instanceof Local' checks assuming that all
instances of Local are simple local vars can produce faulty code
(as in KT-23260, where a local lateinit var was not explicitly put on
stack when passed as an argument to an inline function, thus causing
null propagation).

 #KT-23260 Fixed Target versions 1.2.50
2018-04-20 14:51:34 +03:00
Mikhail Zarechenskiy 4f3fde2334 Regenerate tests 2018-04-20 13:06:22 +03:00
Mikhail Zarechenskiy 397cc4f772 [NI] Support implicit invoke calls on parenthesized receivers 2018-04-20 13:06:21 +03:00
Vyacheslav Gerasimov 0c6fb77637 Build: Set dependency on :dist for js.tests project test tasks 2018-04-20 11:35:55 +03:00
Vyacheslav Gerasimov 09a347b2d4 Disable assertion in RecompilableScriptFunctionData for js tests
which fails due to a bug in nashorn

 #KT-23637 Fixed
2018-04-20 11:35:42 +03:00
Zalim Bashorov d40b0b556c Regenerate tests after fix usages of IGNORE_BACKEND_WITHOUT_CHECK 2018-04-19 13:18:31 +03:00
Zalim Bashorov ad2ea8f999 Remove IGNORE_BACKEND_WITHOUT_CHECK and introduce DONT_RUN_GENERATED_CODE
Support DONT_RUN_GENERATED_CODE in JS Box tests.

IGNORE_BACKEND_WITHOUT_CHECK is removed because of
it's often wrongly used and in most cases can be
replaced with IGNORE_BACKEND or DONT_RUN_GENERATED_CODE
or with combination of them.
2018-04-19 13:17:28 +03:00
Zalim Bashorov d03a128aa5 [JS IR BE] mute failed tests 2018-04-19 13:17:28 +03:00
Zalim Bashorov ab03ab84bb Regenerate tests 2018-04-19 13:17:27 +03:00
Zalim Bashorov a63b2e1bbd Some changes in test generating infrastructure:
* add separate run function for each test class to simplify and deduplicate generated code
* move the code that process IGNORE_BACKEND directive to the separate function, outside of generated code.
** it reduces size and complexity of a generated code
** it allows to mute and unmute tests w/o regenerate tests
* add an ability to generate IGNORE_BACKEND directive automatically, it's disabled by default
* add an ability to remove IGNORE_BACKEND directive automatically, it's enabled by default
* remove whitelists
2018-04-19 13:17:22 +03:00
Zalim Bashorov 4227d8e73a Remove accidentally left test classes: BytecodeTextTestGenerated and JsTypedArraysBoxTestGenerated 2018-04-19 13:17:22 +03:00
Alexey Tsvetkov 701f96998a Remove unused SourceInfo interface 2018-04-19 05:18:54 +03:00
Alexey Tsvetkov 87558873b5 Fix source element for JsSwitch generated from 'when'
Before this change we set JsSwitch source to subject's JsExpression.
We ignore these types of source elements during:
1. js ast serialization (see 'JsAstSerializer.extractLocation');
2. source map generation (see 'SourceMapBuilderConsumer.addMapping').

However we might add indent during source generation
(see 'JsToStringGenerationVisitor.pushSourceInfo').

That seemingly broken 'testEnumEntryRemoved' in
'IncrementalJsCompilerRunnerTestGenerated.ClassHierarchyAffected',
because deserialized ast during incremental build would not
have source element at all (JsExpression was ignored), but ast
during rebuild would have JsExpression source element.
2018-04-19 05:18:54 +03:00
Alexey Tsvetkov b0e8c85e88 Compare JS source maps in readable way in IC tests 2018-04-19 05:18:54 +03:00
Zalim Bashorov e1ba08e03d [JS IR BE] add new items to whitelist and regenerate tests 2018-04-16 14:34:44 +03:00
Alexander Udalov 30b9caeae6 Fix NPE in data class 'equals' codegen
Do not perform the optimization from 0a11385006 for data class
properties of nullable types
2018-04-12 22:19:30 +02:00
Ilya Gorbunov 69ebb3bfb0 Switch to the new stdlib source generation scheme
Remove old generated sources for stdlib-jvm and stdlib-js
2018-04-12 17:53:00 +03:00