From a074e1d6f302b31cf0e430971bcf69a827fdbecc Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 25 Dec 2019 12:17:33 +0100 Subject: [PATCH] [kotlin compiler][update] 1.4.0-dev-216 (#3716) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix KonanMangler to make it fit new mangle API (cherry picked from commit c73d3278cbdfc16891521038d4b161e51eeab4ba) * Rename Appendable methods parameters (cherry picked from commit 2f90c0e58db0613f5a7e1e659f32f0e1e44d2f70) * [kotlin compiler][update] 1.4.0-dev-216 * 4efab517513 - (tag: build-1.4.0-dev-216) Fix allopen call from UL methods (3 days ago) * 8d02d00f227 - (tag: build-1.4.0-dev-214) [IR Serialization] Removed native-specific hack in mangler (3 days ago) * 1f55b59fa35 - (tag: build-1.4.0-dev-210) Unmute a fixed Fir2IrText test (3 days ago) * 26822a0cdea - Minor: IGNORE_BACKEND: ANY_FIR -> IGNORE_BACKEND_FIR: ANY (3 days ago) * 38a37973253 - (tag: build-1.4.0-dev-206) Unmute FIR2IR test (due to fixed bug in FIR) (3 days ago) * 69e9ae94c6a - (tag: build-1.4.0-dev-203) Use snakeyaml from maven instead of from intellij (3 days ago) * 2adcb5dec47 - (tag: build-1.4.0-dev-200) Add the ANY_FIR target for muting Fir2IrText tests (3 days ago) * a4b005fd5d2 - PSI2IR: generate field writes for all val property assignments (3 days ago) * 92f8432b1ef - New J2K: Fix not converted jetbrains nullability annotations for types (3 days ago) * 3840294f442 - (tag: build-1.4.0-dev-199) Add tests for obsolete issues (3 days ago) * c3ffef18400 - Fix incorrect use of language feature (3 days ago) * c94dd2939ef - (tag: build-1.4.0-dev-196) [NI] Add test for KT-32429 (3 days ago) * e730965bc50 - [NI] Approximate intersection type in type argument to star if it's necessary (3 days ago) * 26f7bf1c219 - Regenerate tests (3 days ago) * e466fd5196c - [NI] Infer type variable to Nothing if all upper constraints are from upper bounds (3 days ago) * 7fed7a840ba - [NI] Update some testdata broken in NI (3 days ago) * c311a66e5e8 - (tag: build-1.4.0-dev-195) Fix 191 & as35 compilation (3 days ago) * d6daaf14f8f - Fix "Protected function call from public-API inline function is prohibited" error (3 days ago) * 2dcc6177748 - (tag: build-1.4.0-dev-192) Minor: reformat (4 days ago) * e99dc0f87fc - Show only unique diagnostics in psi checker (KT-35578) (4 days ago) * 75beaa861f8 - Use abstract class to prevent GradleDaemonAnalyzerTestCase running as test (4 days ago) * 3e484948378 - Proper ignore new daemon tests without warning about tests absence (4 days ago) * 19422b12b47 - (tag: build-1.4.0-dev-189) Build: Add buildScanUserData script gradle-build-scan-snippets (4 days ago) * c89def9e061 - (tag: build-1.4.0-dev-188) [minor] Update test data for 1.4 (4 days ago) * 254dc8f71c7 - (tag: build-1.4.0-dev-183) Build: Drop IntelliJ 2018.3 and Android Studio 3.4 support (4 days ago) * ae0efa77e39 - [minor] updating fir testdata (4 days ago) * 75c94f3b0f3 - (tag: build-1.4.0-dev-180) Build: Upgrade kotlin-build-gradle-plugin to 0.0.8 (4 days ago) * 20faa9e3e48 - Build: Make use of user & password properties in build cache configuration (4 days ago) * e43ea7e1830 - Build: Add build cache user and password properties to BuildProperties (4 days ago) * 1ee54d74d0b - (tag: build-1.4.0-dev-178) [FIR] Use FIR resolution API in explorer window (4 days ago) * 87c698f8437 - [FIR] Remove obsolete total kotlin resolve test (4 days ago) * a3d531e8b49 - [FIR] Extract jvm-only call conflict resolver (4 days ago) * 05308a36527 - [FIR] Introduce module for all jvm extensions (4 days ago) * 99489321f19 - (tag: build-1.4.0-dev-177) [FIR] Add forgotten test data for old FE test (4 days ago) * fe8d68ecc71 - Use different transformers per module in FIR diagnostics tests (4 days ago) * c4e6f8a6403 - Cache FirPackageMemberScope in ScopeSession instead of member scope provider (4 days ago) * cb93b25fcae - FIR: make possible to use differently typed IDs in ScopeSession (4 days ago) * 4d1b032c1f6 - Rename: FirSelfImportingScope -> FirPackageMemberScope (4 days ago) * 4e14d04926f - (tag: build-1.4.0-dev-173) [minor] fix testdata for compiler 1.4 (4 days ago) * 6e6d9ae7951 - (tag: build-1.4.0-dev-170) FIR body resolve: start analyzing files with independent context (4 days ago) * ada7f3da6ca - FIR: resolve anonymous initializer in context independent mode (4 days ago) * 99643e1b2d4 - FIR: do not run full tower resolve on integer literal type (4 days ago) * cb3f02d015d - FIR modularized test: do not print unnecessary stuff to the console (4 days ago) * 48c74fd1ba4 - FIR black box codegen tests: do not print bytecode to the console (4 days ago) * ad6f4fa92ee - FirResolveBench: do not print unnecessary stuff to the console #KT-35030 Fixed (4 days ago) * f38bb19fc67 - [minor] Fix testdata for compiler 1.4 (4 days ago) * 06dc2caf41b - (tag: build-1.4.0-dev-169) Fix compilation for AS (4 days ago) * ac47c0cf3c5 - (tag: build-1.4.0-dev-168) [minor] Update test data for 1.4 (4 days ago) * ba640be81de - (tag: build-1.4.0-dev-164) KT-32178 Keyword completion: don't add 'fun' after 'suspend' in type position (4 days ago) * 1f878049eb4 - (tag: build-1.4.0-dev-163) Allow @author usage in `...projectWizard.settings.version.maven` package (4 days ago) * 280cb5b60b2 - Exclude kotlin-test-nodejs-runner generated folders from code conformance test (4 days ago) * 2c684c56a3a - Mute testVersionsAreConsistent test (KT-35567) (4 days ago) * 650cfeaaed7 - (tag: build-1.4.0-dev-161) Update inline tests to void PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR (4 days ago) * 8322398133a - (tag: build-1.4.0-dev-160) [minor] Fix testdata for compiler 1.4 (4 days ago) * 45e881f03f6 - (tag: build-1.4.0-dev-155) [NI] Fix inference if inner system has only by "uninteresting" constraint (4 days ago) * 3e537cfcb48 - [minor] [NI] Additional test for loosing type annotations on extension functions (4 days ago) * 1c6da8b9b44 - (tag: build-1.4.0-dev-149) [FIR] Add separate diagnostic tests working in light tree mode (4 days ago) * 9efb1fc527e - Change FIR modularized test to be able to work in light tree mode (4 days ago) * 3f76408c6ff - Protect FirResolveBench from light tree (this prevents cast to KtFile exception) (4 days ago) * 09c3279cc76 - (tag: build-1.4.0-dev-148) PSI2IR: Infer smart cast on dispatch receiver of FAKE_OVERRIDE calls (4 days ago) * feda832eb73 - (tag: build-1.4.0-dev-146) Tests: switch off script configuration update in MutlifileRefactoringTests (4 days ago) * 233d400e931 - Scripting: remove unexpected cache clear (4 days ago) * 7ba0a11f432 - (tag: build-1.4.0-dev-144) FIR light tree: add forgotten default bound for type parameters (4 days ago) * ebb1ca7cd9c - Fix 'fir:lightTree' build script to be able to run light tree tests (4 days ago) * 7abb3fc9876 - Protect FirJavaElementFinder from light tree (4 days ago) * 774eb621180 - FIR resolve bench: make possible building FIR files via light tree (4 days ago) * d702dc862a3 - FIR light tree: eliminate unused 'project' argument (4 days ago) * e8131d6e30a - (tag: build-1.4.0-dev-142) Choose Java field during overload resolution with a pure Kotlin property (4 days ago) * aa8578b6756 - (tag: build-1.4.0-dev-141) Allow null operators for result and using Result as return type with enabled InlineClasses (4 days ago) * eed5b3f1d1d - Add quickfix for removing redundant spread operator (4 days ago) * ee36fb903f0 - Allow use expression of array type as named argument for vararg (4 days ago) * 0cb48999ff6 - (tag: build-1.4.0-dev-135) JVM IR: retain optional annotations as package private classes (5 days ago) * 5d3ef4c632d - (tag: build-1.4.0-dev-132) JVM IR: Fix names of fake local variables for inline arguments (5 days ago) * c486fa61894 - (tag: build-1.4.0-dev-129) NI: Report incompatible receiver of callable reference (5 days ago) * dd56c3d9182 - NI: Fix property references overload ambiguity (5 days ago) * ab79c3e0a06 - Properly mute (and unmute) tests for unrelated backends (5 days ago) * ffa368e0a71 - Reconciled -Xklib-mpp with commonizer (5 days ago) * dc8240c24eb - Expect/actual support in klibs under -Xklib-mpp (5 days ago) * 218d7c31ed5 - (tag: build-1.4.0-dev-127) Remove muted tests on automatic experimental->release coroutine migration (5 days ago) * 3ac5cb9a6e7 - Minor, fix typos in exception message (5 days ago) * ebb9f096563 - (tag: build-1.4.0-dev-117, minamoto/ir/inliner/inliner-no-local-object-copier-1/kotlin) [NI] Fix issues with star projection uncapturing (5 days ago) * 86dc0925b10 - [NI] Preserve constraint position for OnlyInputType during incorporation (5 days ago) * 2fc79856a24 - [NI] Fix OnlyInputTypes for captured types (5 days ago) * 16db3a8b5f9 - (tag: build-1.4.0-dev-115) Fix compiler and IDE tests on Experimental/RequiresOptIn (5 days ago) * 830f0c6137b - (tag: build-1.4.0-dev-113) Fix class not found exception in gradle wizard tests (5 days ago) * 1ab405a86c6 - Wizard: introduce unit test mode (5 days ago) * 1c305728449 - Wizard: fix android tests (5 days ago) * b2166dc40df - Wizard: fix wrong checking for project kind in UI (5 days ago) * c1ce215b5d2 - Wizard: disable abbility to switch between targets in existing module (5 days ago) * 7204ab091af - Wizard: add suggested module names for js targets (5 days ago) * fc9f63d49f7 - Wizard: do not allow to create more than one target of each type (5 days ago) * aa2992e84a7 - Wizard: add additional applicability checker for template (5 days ago) * 40367635cc8 - Wizard: remove unused android service (5 days ago) * af174b4f74c - Wizard: format templates code (5 days ago) * b29e6d0c696 - Wizard: add simple js template (5 days ago) * 5d56f3d28b8 - Wizard: do not print duplicated repositories (5 days ago) * 32a151f561d - Wizard: introduce interceptors for module templates (5 days ago) * 8bf9c31880f - Wizard: add simple JS client template (5 days ago) * 56fccce305c - Wizard: add basic ktor server template (5 days ago) * f927fb3471e - Wizard: introduce ServicesManager & correctly handle disabled gradle & maven Idea plugins (5 days ago) * 9011eecfdfc - Wizard: change wizard title to experimental (5 days ago) * b10e157147d - Wizard: Create parent group for current and experimental project wizard (5 days ago) * 8684b0d6c10 - Wizard: show experimental new project wizard only by registry flag (5 days ago) * aca193ddd2f - Wizard: Add initial version of the new project wizard (5 days ago) * 4916f166fe4 - (tag: build-1.4.0-dev-111) Move `android.test.dependencies` under `dependencies` folder (5 days ago) * 0d8036bb140 - (tag: build-1.4.0-dev-109) JVM_IR: do not generate main() when extension main is present (5 days ago) * 9d0c736f0ef - (tag: build-1.4.0-dev-108) Use `assertAllTestsPresentByMetadataWithExcluded` for `addSpreadOperatorForArrayAsVarargAfterSam` IDE quick fix test (5 days ago) * 220ea72d65e - (tag: build-1.4.0-dev-87) JVM_IR: add coercion for index in ArrayGet intrinsic (5 days ago) * cca3f13e481 - (tag: build-1.4.0-dev-85) Added multi-module test on inline functions (5 days ago) * bd805d71b13 - (tag: build-1.4.0-dev-84) KT-35463 EA-214439 Pass adjusted files to `KotlinAwareMoveFilesOrDirectoriesDialog` instead of originals (5 days ago) * dd8396efbc8 - (tag: build-1.4.0-dev-72) Convert lambda to reference: support nested class constructor call (#2877) (6 days ago) * 646c7ad0af4 - (tag: build-1.4.0-dev-66) [IDE, klib] Support in IDE klibs with dynamic type (6 days ago) * 34eb6645041 - (tag: build-1.4.0-dev-61) Build: Remove teamcity tag setup from settings.gradle (tag via gradle arguments instead) (6 days ago) * 7eda60d57eb - (tag: build-1.4.0-dev-59) Minor, add more tests on signature-polymorphic calls (6 days ago) * 64d40b47436 - Support JVM polymorphic signature calls to methods with void return type (6 days ago) * e009c7064eb - (tag: build-1.4.0-dev-58, tag: build-1.4.0-dev-57) Add -Xopt-in command line argument (6 days ago) * cdbabf224f3 - Introduce RequiresOptIn and OptIn annotations (6 days ago) * 33bc3db1449 - Deprecate -Xexperimental compiler argument (6 days ago) * 571bba7c045 - (tag: build-1.4.0-dev-55) Build: Add teamcity tag to build scans (6 days ago) * b868e6f8da4 - (tag: build-1.4.0-dev-50) Rename Appendable methods parameters (6 days ago) * d1c0dfe8acf - (tag: build-1.4.0-dev-45) [FIR] Run System.gc() before each pass in modularized tests (6 days ago) * 0f71460833b - (tag: build-1.4.0-dev-39) Add missed comment (6 days ago) * dbb282e60f5 - Arg postfix postfix completion: fix typo in description (6 days ago) * cad3cb1bbe8 - [KLIB] Fix references to type made from TypeParameter in KotlinMangler - promote ABI version (6 days ago) * 3544bf17f4e - (tag: build-1.4.0-dev-38) ConeIntegerLiteralType: extract COMPARABLE_TAG (6 days ago) * 3d961ffe8fe - ConeTypeContext: use built-in nullable any type (6 days ago) * 4d0b1212238 - FIR SAM resolution: use built-in nullable any type (6 days ago) * c6db5abb14a - FIR call resolve: make earlier qualifier resolver reset (6 days ago) * 684bdc44bb3 - FIR: add implementation of reified type parameter references (6 days ago) * cccb95465e1 - FIR status resolve: update type alias phase (6 days ago) * a6b6c9ba181 - Minor: remove when unreachable branches (6 days ago) * af3ab9178a0 - Minor: remove unused imports (6 days ago) * 8e53ccb8521 - (tag: build-1.4.0-dev-31) Add ML completion jar to the resulting plugin jar (6 days ago) * e92985458bf - (tag: build-1.4.0-dev-25) JVM_IR: skip private declarations in imported classes (6 days ago) * 776736a25ab - (tag: build-1.4.0-dev-22) [IR] Remapped some forgotten types during IR copying (6 days ago) * f0992772109 - [JS IR] Unmute tests and add KJS_WITH_FULL_RUNTIME (6 days ago) * e32ec2a7892 - [JS IR BE] Support typeOf (6 days ago) * 3df8393edec - [JS IR] Properly report compiler errors (6 days ago) * ea8fa55f12d - (tag: build-1.4.0-dev-17) Rename kotlinJUnitSettings test data folder to fix tests (6 days ago) * 2aa1c40de45 - Avoid checking trivial incorporated constraints (6 days ago) * 02f3cedcf4b - FIR: Optimize ConeInferenceContext::typeDepth (6 days ago) * b53c00cf698 - FIR: Optimize simple things in inference (6 days ago) * 03c2350e799 - (tag: build-1.4.0-dev-14) Keep original casts during reification to avoid VerifyError (6 days ago) * 6f16d029205 - (tag: build-1.4.0-dev-13) [gradle-native-plugin] Build static caches instead of dynamic (6 days ago) * b6de3c2fcc9 - (tag: build-1.4.0-dev-9) Disable tail-call optimization for suspend functions with Unit return type (6 days ago) * 09acdb655d5 - (tag: build-1.4.0-dev-6) KtScratchExecutionSession: fix compilation for 191 (6 days ago) * 898308c7ba9 - (tag: build-1.4.0-dev-4) KotlinDebuggerCaches: fix INRE #EA-219472 Fixed (6 days ago) * 3f500c6e924 - KotlinConsoleRunner: fix INRE #EA-219478 Fixed (6 days ago) * 02beb72ab12 - IDEKotlinAsJavaSupport: fix INRE #EA-213321 Fixed (6 days ago) * 4d7fe78a515 - KotlinFunctionBreakpoint: fix INRE #KT-35316 Fixed #EA-219418 Fixed (6 days ago) * 09bcfab047c - KotlinNativeModuleConfigurator: fix INRE #EA-219416 Fixed (6 days ago) * 86f9253fa05 - KtScratchExecutionSession: fix INRE #EA-218701 Fixed (6 days ago) * 78f7ed2c276 - KotlinVariableInplaceIntroducer: fix PIEAE #EA-209820 Fixed (6 days ago) * 580885245d4 - JavaToKotlinAction: fix KNPE #EA-215300 Fixed (6 days ago) * 34dcc72e7f7 - idea: fix some `ControlFlowException` #EA-219412 Fixed (6 days ago) * cdabff19417 - KotlinImportOptimizer: should use with `isIndeterminate=false` #KT-34928 Fixed (6 days ago) * 7c9826b60b0 - PerModulePackageCacheService: fix NPE for code injection #KT-35208 Fixed (6 days ago) * ebf3bfc0489 - KotlinIntroduceImportAliasHandler: remove unnecessary transformations (6 days ago) * 9f1f743d55c - (tag: build-1.4.0-dev-2923) FIR: fix test data after Make 'statics visible from nested classes' (6 days ago) * 7b1771d4322 - (tag: build-1.3.70-dev-2917) Remove braces from 'when' entry: do not suggest when statement is lambda that has no arrow (6 days ago) * afc680d5c94 - (tag: build-1.3.70-dev-2915) JavaMapForEachInspection: do not report when lambda parameter is destructuring declaration (6 days ago) * 8857827dce2 - "Add not-null asserted (!!) call": do not add `this` when implicit receiver is not extension receiver (6 days ago) * f1c605d0f72 - (tag: build-1.3.70-dev-2914) AddFunctionParametersFix: improve parameter name for 'it' argument (6 days ago) * f8f50b2131e - (tag: build-1.3.70-dev-2913) DeprecatedCallableAddReplaceWithInspection: add argument name if needed (6 days ago) * 23749bdde7f - Add constructor parameter: add generic types correctly (6 days ago) * 76a65af14b4 - (tag: build-1.3.70-dev-2912) Fix #KT-31967 Typo in inspection name: "+= create new list under the hood" (6 days ago) * ae827bfd800 - (tag: build-1.3.70-dev-2911) Use declaration-site session in phased FIR instead of use-site session (6 days ago) * 37839a181c9 - Introduce FirIdeModuleDependenciesSymbolProvider #KT-35424 In Progress (6 days ago) * befcfad8984 - Rename: IdeFirProvider -> FirIdeProvider (6 days ago) * 8703da5a254 - Rename: FirResolveState -> FirModuleResolveState to reflect per-module status (6 days ago) * 8dbbd64beb0 - (tag: build-1.3.70-dev-2910) idea: cleanup code (6 days ago) * e77d8657f4d - (tag: build-1.3.70-dev-2904) Fix configuration for AS 3.5 (7 days ago) * 54d707b3b63 - (tag: build-1.3.70-dev-2903) JVM_IR: make constructors of named local classes public (7 days ago) * 82f48cdd11e - JVM_IR: Backwards compatible handling of default tailrec params. (7 days ago) * 90a1b15b773 - (tag: build-1.3.70-dev-2899) [FIR] Make statics visible from nested companion/classes (7 days ago) * 02cbe990c03 - [FIR] Use fast firSymbolProvider access (7 days ago) * 2e27862d38f - [FIR] Cache lookupTag lookup on creation from symbol (partially) (7 days ago) * 0fb883ef628 - [FIR] Use builtinTypes instead of creating new ones (7 days ago) * 5de69471b04 - [FIR] Use yieldIfNeed instead of yield (7 days ago) * 81759e8c553 - [FIR] Use proper sourceScope for modularized tests (7 days ago) * 0a2c457f54e - [FIR] Properly check typealias fqn matching (7 days ago) * d0c58be4e9a - [FIR] Pass proper use-site session in deserialized provider (7 days ago) * 85ff834fdb0 - [FIR] Do not create Kotlin scopes for handledByJava classes (7 days ago) * dd803cb6507 - [FIR] Fix moduleInfo module names (7 days ago) * 7f51be9cd34 - (tag: build-1.3.70-dev-2889) Minor, change parameter name of FrameMap.enter/leave (7 days ago) * f51a0048f66 - Minor, rename test and avoid commented directive (7 days ago) * 561cde9d069 - JVM IR: minor, add exception message to IrFrameMap.typeOf (7 days ago) * 0b7c11c96e8 - (tag: build-1.3.70-dev-2883) [JS IR] Fix external fields naming (7 days ago) * 02db5ea0eb5 - [JS IR] Fix state machine builder (7 days ago) * ccb9a4e0a90 - (tag: build-1.3.70-dev-2881, tag: build-1.3.70-dev-2876) [FIR TEST]: add problematic test for T::class.java case (7 days ago) * 38b0de4ab6f - (tag: build-1.3.70-eap-3, tag: build-1.3.70-dev-2873) Scripting: do not start multiple request when related file was changed (7 days ago) * fba17d5b9a4 - Minor, tests: clear memory cache in tests that check scripting file attributes (7 days ago) * 780c61dc164 - Fix line separators in tests (7 days ago) * 31887d2fd19 - Scripting: check if affected scripts are changed using file modification stamp instead of mark them out of date in cache (7 days ago) * ec04f0059c6 - Scripting: do not threat comments and spaces as modifications inside essential block (7 days ago) * 2f35d6d8683 - Scripting: save inputs stamp and diagnostics to file attributes (7 days ago) * 13b4e8716c8 - Changes inside initscript and pluginManagement blocks should invalidate script configuration (7 days ago) * d68c3584f27 - Scripting: add test for loading configuration for gradle scripts (7 days ago) * 424a2c72b26 - Implement KotlinWordsScanner (7 days ago) * 886e9613b8a - Move script related extensions to separate xml-s (7 days ago) * 2e933507c6e - Fix duplicated “Kotlin Script” definition for Gradle/Kotlin projects (KT-35096) (7 days ago) * 153d894afb4 - (tag: build-1.3.70-eap-2, tag: build-1.3.70-dev-2870, minamoto/compler-update/kotlin) FIR: Optimize ConeTypeContext::asSimpleType (7 days ago) * 1790dcf80c5 - FIR: Reorder when entries in ConeTypeContext::typeConstructor (7 days ago) * a14852a6ec5 - Minor. Make ConeClassLikeTypeImpl final (7 days ago) * ac81f046fd2 - (tag: build-1.3.70-dev-2867) gradle.kts importing test: don't run on 191 (including as34) (7 days ago) * a2d8e2435fb - (tag: build-1.3.70-dev-2863) Reorder steps in psi2ir so postprocessing goes before unbound symbols stub generating (7 days ago) * 737eaebee6c - (tag: build-1.3.70-dev-2857) FIR resolve: fold flexible types whenever possible #KT-31528 Fixed (7 days ago) * 9f5a02dc7ad - (tag: build-1.3.70-dev-2853) gradle.kts importing: fix as36 (7 days ago) * 637e6f5acc5 - (tag: build-1.3.70-dev-2852) FIR: add forgotten test data for old FE test (7 days ago) * acf48a1af78 - (tag: build-1.3.70-dev-2850) Return NONE from FirSuperTypeScope if nothing is found (7 days ago) * 001af684957 - FIR: distinguish lazy/non-lazy nested scopes more clear (7 days ago) * fea224749bb - FIR: introduce symbolProvider.getNestedClassifierScope to choose lazy/non-lazy (7 days ago) * 663d545d79b - FIR: get rid of symbolProvider.getClassDeclaredMemberScope at all (7 days ago) * af87a183c2b - FIR: get rid of symbolProvider.getClassDeclaredMemberScope usages in compiler (7 days ago) * f497231acda - FIR: try to use JavaSymbolProvider directly in lazy nested classifier scope (7 days ago) * 48d60ed4eaa - (tag: build-1.3.70-dev-2849) revert accidentally changed vcs.xml (7 days ago) * 039090d2bf0 - (tag: build-1.3.70-dev-2848) gradle.kts importing tests: run gradle 6.0.1 only for that test (7 days ago) * 1930ab7c388 - gradle.kts importing: reduce bunch files (7 days ago) * c0690ff5f6f - gradle.kts importing: move code to dedicated package (7 days ago) * 6e3e65c490e - gradle.kts importing: add support for included builds and fix sub projects (7 days ago) * fef193be637 - gradle.kts: add tests for importing scripts configuration (7 days ago) * dcd67d79f45 - gradle.kts: script models should be imported in ProjectData key, not in GradleSourceSetData (7 days ago) * fd16078a348 - gradle.kts: add clearCaches method for testing (7 days ago) * 559b067f913 - gradle.kts: move areSimilar to utils.kt to use in tests (7 days ago) * 249f72585d6 - (tag: build-1.3.70-dev-2847) Fix test data in FIR old FE diagnostics test (7 days ago) * Initial expect/actual support in klibs under -Xklib-mpp flag. (cherry picked from commit a777eb110f478e4537c2f569bd1c7ac24706aaf9) Co-authored-by: Roman <37534597+romanart@users.noreply.github.com> Co-authored-by: Abduqodiri Qurbonzoda Co-authored-by: alexander-gorshenev --- .../jetbrains/kotlin/backend/konan/Context.kt | 5 ++- .../kotlin/backend/konan/ToplevelPhases.kt | 24 ++++++++--- .../backend/konan/llvm/BinaryInterface.kt | 40 +++++++++++-------- .../serialization/KonanIrFileSerializer.kt | 12 ++++-- .../serialization/KonanIrModuleSerializer.kt | 11 +++-- .../konan/serialization/KonanIrlinker.kt | 12 +++--- gradle.properties | 11 +++-- .../org/jetbrains/kotlin/cli/klib/main.kt | 10 +++-- .../src/main/kotlin/kotlin/text/Appendable.kt | 26 ++++++------ .../main/kotlin/kotlin/text/StringBuilder.kt | 10 ++--- .../konan/library/impl/KonanLibraryImpl.kt | 13 ++++-- 11 files changed, 106 insertions(+), 68 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt index 2c44887afed..92714f686d0 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Context.kt @@ -48,6 +48,7 @@ import org.jetbrains.kotlin.backend.konan.objcexport.ObjCExport import org.jetbrains.kotlin.backend.konan.llvm.coverage.CoverageManager import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor import org.jetbrains.kotlin.ir.descriptors.WrappedTypeParameterDescriptor +import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.konan.library.KonanLibraryLayout @@ -57,7 +58,7 @@ import org.jetbrains.kotlin.library.SerializedIrModule * Offset for synthetic elements created by lowerings and not attributable to other places in the source code. */ -internal class SpecialDeclarationsFactory(val context: Context) : KotlinMangler by KonanMangler { +internal class SpecialDeclarationsFactory(val context: Context) : KotlinMangler by KonanManglerForBE { private val enumSpecialDeclarationsFactory by lazy { EnumSpecialDeclarationsFactory(context) } private val outerThisFields = mutableMapOf() private val bridgesDescriptors = mutableMapOf, IrSimpleFunction>() @@ -206,6 +207,8 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config) { lateinit var cAdapterGenerator: CAdapterGenerator + lateinit var expectDescriptorToSymbol: MutableMap + override val builtIns: KonanBuiltIns by lazy(PUBLICATION) { moduleDescriptor.builtIns as KonanBuiltIns } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt index 96dffe4060c..95069ffd1d9 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ToplevelPhases.kt @@ -17,10 +17,12 @@ import org.jetbrains.kotlin.backend.konan.serialization.* import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport import org.jetbrains.kotlin.config.CommonConfigurationKeys import org.jetbrains.kotlin.config.languageVersionSettings +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.descriptors.konan.isKonanStdlib import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator import org.jetbrains.kotlin.ir.util.SymbolTable import org.jetbrains.kotlin.ir.util.addChild @@ -165,7 +167,6 @@ internal val psiToIrPhase = konanUnitPhase( // Note: using [llvmModuleSpecification] since this phase produces IR for generating single LLVM module. val exportedDependencies = (getExportedDependencies() + modulesWithoutDCE).distinct() - val deserializer = KonanIrLinker( moduleDescriptor, this as LoggingContext, @@ -195,6 +196,8 @@ internal val psiToIrPhase = konanUnitPhase( dependenciesCount = dependencies.size } + deserializer.initializeExpectActualLinker() + val functionIrClassFactory = BuiltInFictitiousFunctionIrClassFactory( symbolTable, generatorContext.irBuiltIns, reflectionTypes) val irProviderForInteropStubs = IrProviderForInteropStubs() @@ -205,7 +208,11 @@ internal val psiToIrPhase = konanUnitPhase( ) val irProviders = listOf(irProviderForInteropStubs, functionIrClassFactory, deserializer, stubGenerator) stubGenerator.setIrProviders(irProviders) - val module = translator.generateModuleFragment(generatorContext, environment.getSourceFiles(), irProviders) + + expectDescriptorToSymbol = mutableMapOf() + val module = translator.generateModuleFragment(generatorContext, environment.getSourceFiles(), irProviders, expectDescriptorToSymbol) + + deserializer.finalizeExpectActualLinker() if (this.stdlibModule in modulesWithoutDCE) { functionIrClassFactory.buildAllClasses() @@ -247,12 +254,17 @@ internal val copyDefaultValuesToActualPhase = konanUnitPhase( internal val serializerPhase = konanUnitPhase( op = { + val mppKlibs = config.configuration.get(CommonConfigurationKeys.KLIB_MPP)?:false val descriptorTable = DescriptorTable.createDefault() - serializedIr = KonanIrModuleSerializer(this, irModule!!.irBuiltins, descriptorTable).serializedIrModule(irModule!!) + + serializedIr = KonanIrModuleSerializer( + this, irModule!!.irBuiltins, descriptorTable, expectDescriptorToSymbol, skipExpects = !mppKlibs + ).serializedIrModule(irModule!!) + val serializer = KlibMetadataMonolithicSerializer( this.config.configuration.languageVersionSettings, - config.configuration.get(CommonConfigurationKeys.METADATA_VERSION - )!!, descriptorTable) + config.configuration.get(CommonConfigurationKeys.METADATA_VERSION)!!, + descriptorTable, !mppKlibs) serializedMetadata = serializer.serializeModule(moduleDescriptor) }, name = "Serializer", @@ -464,4 +476,4 @@ internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) { disableUnless(ghaPhase, getBoolean(KonanConfigKeys.OPTIMIZATION)) disableUnless(verifyBitcodePhase, config.needCompilerVerification || getBoolean(KonanConfigKeys.VERIFY_BITCODE)) } -} \ No newline at end of file +} diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt index 101c7a9848b..912f4836f68 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/BinaryInterface.kt @@ -29,7 +29,7 @@ import org.jetbrains.kotlin.library.uniqueName // TODO: revise the naming scheme to ensure it produces unique names. // TODO: do not serialize descriptors of non-exported declarations. -object KonanMangler : KotlinManglerImpl() { +abstract class AbstractKonanMangler : KotlinManglerImpl() { override val IrType.isInlined get() = this.isInlinedNative() @@ -62,18 +62,19 @@ object KonanMangler : KotlinManglerImpl() { return false } - override val IrFunction.argsPart get() = this.valueParameters.map { + override fun IrFunction.valueParamsPart(typeParameterNamer: (IrTypeParameter) -> String): String { + return this.valueParameters.map { - // TODO: there are clashes originating from ObjectiveC interop. - // kotlinx.cinterop.ObjCClassOf.create(format: kotlin.String): T defined in platform.Foundation in file Foundation.kt - // and - // kotlinx.cinterop.ObjCClassOf.create(string: kotlin.String): T defined in platform.Foundation in file Foundation.kt - - val argName = - if (this.hasObjCMethodAnnotation || this.hasObjCFactoryAnnotation || this.isObjCClassMethod()) "${it.name}:" else "" - "$argName${typeToHashString(it.type)}${if (it.isVararg) "_VarArg" else ""}" - }.joinToString(";") + // TODO: there are clashes originating from ObjectiveC interop. + // kotlinx.cinterop.ObjCClassOf.create(format: kotlin.String): T defined in platform.Foundation in file Foundation.kt + // and + // kotlinx.cinterop.ObjCClassOf.create(string: kotlin.String): T defined in platform.Foundation in file Foundation.kt + val argName = + if (this.hasObjCMethodAnnotation || this.hasObjCFactoryAnnotation || this.isObjCClassMethod()) "${it.name}:" else "" + "$argName${typeToHashString(it.type, typeParameterNamer)}${if (it.isVararg) "_VarArg" else ""}" + }.joinToString(";") + } override val IrFunction.platformSpecificFunctionName: String? get() { @@ -123,6 +124,13 @@ object KonanMangler : KotlinManglerImpl() { } } +object KonanMangler : AbstractKonanMangler() + +object KonanManglerForBE : AbstractKonanMangler() { + override fun mangleTypeParameter(typeParameter: IrTypeParameter, typeParameterNamer: (IrTypeParameter) -> String): String = + typeParameter.name.asString() +} + internal val IrClass.writableTypeInfoSymbolName: String get() { assert (this.isExported()) @@ -138,15 +146,15 @@ internal val IrClass.objectInstanceGetterSymbolName: String return "kobjget:$fqNameForIrSerialization" } -val IrFunction.functionName get() = with(KonanMangler) { functionName } +val IrFunction.functionName get() = with(KonanManglerForBE) { functionName } -val IrFunction.symbolName get() = with(KonanMangler) { symbolName } +val IrFunction.symbolName get() = with(KonanManglerForBE) { symbolName } -val IrField.symbolName get() = with(KonanMangler) { symbolName } +val IrField.symbolName get() = with(KonanManglerForBE) { symbolName } -val IrClass.typeInfoSymbolName get() = with(KonanMangler) { typeInfoSymbolName } +val IrClass.typeInfoSymbolName get() = with(KonanManglerForBE) { typeInfoSymbolName } -fun IrDeclaration.isExported() = with(KonanMangler) { isExported() } +fun IrDeclaration.isExported() = with(KonanManglerForBE) { isExported() } // TODO: bring here dependencies of this method? internal fun RuntimeAware.getLlvmFunctionType(function: IrFunction): LLVMTypeRef { diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrFileSerializer.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrFileSerializer.kt index bcb3925ef42..a182caf5c5c 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrFileSerializer.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrFileSerializer.kt @@ -4,15 +4,19 @@ import org.jetbrains.kotlin.backend.common.LoggingContext import org.jetbrains.kotlin.backend.common.serialization.DeclarationTable import org.jetbrains.kotlin.backend.common.serialization.IrFileSerializer import org.jetbrains.kotlin.backend.konan.RuntimeNames +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.util.hasAnnotation class KonanIrFileSerializer( - logger: LoggingContext, - declarationTable: DeclarationTable, - bodiesOnlyForInlines: Boolean = false -): IrFileSerializer(logger, declarationTable, bodiesOnlyForInlines) { + logger: LoggingContext, + declarationTable: DeclarationTable, + expectDescriptorToSymbol: MutableMap, + skipExpects: Boolean, + bodiesOnlyForInlines: Boolean = false +): IrFileSerializer(logger, declarationTable, expectDescriptorToSymbol, skipExpects = skipExpects, bodiesOnlyForInlines = bodiesOnlyForInlines) { override fun backendSpecificExplicitRoot(declaration: IrFunction) = declaration.annotations.hasAnnotation(RuntimeNames.exportForCppRuntime) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrModuleSerializer.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrModuleSerializer.kt index bba1cc329a1..01267f553e5 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrModuleSerializer.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrModuleSerializer.kt @@ -4,9 +4,11 @@ import org.jetbrains.kotlin.backend.common.LoggingContext import org.jetbrains.kotlin.backend.common.descriptors.propertyIfAccessor import org.jetbrains.kotlin.backend.common.serialization.* import org.jetbrains.kotlin.backend.konan.descriptors.isFromInteropLibrary +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.ir.declarations.IrDeclaration import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns +import org.jetbrains.kotlin.ir.symbols.IrSymbol import org.jetbrains.kotlin.ir.util.UniqId import org.jetbrains.kotlin.resolve.descriptorUtil.module @@ -34,13 +36,14 @@ private class KonanDeclarationTable( class KonanIrModuleSerializer( logger: LoggingContext, irBuiltIns: IrBuiltIns, - private val descriptorTable: DescriptorTable + private val descriptorTable: DescriptorTable, + private val expectDescriptorToSymbol: MutableMap, + val skipExpects: Boolean ) : IrModuleSerializer(logger) { private val globalDeclarationTable = KonanGlobalDeclarationTable(irBuiltIns) override fun createSerializerForFile(file: IrFile): KonanIrFileSerializer = - KonanIrFileSerializer(logger, KonanDeclarationTable(descriptorTable, globalDeclarationTable, 0)) - -} \ No newline at end of file + KonanIrFileSerializer(logger, KonanDeclarationTable(descriptorTable, globalDeclarationTable, 0), expectDescriptorToSymbol, skipExpects = skipExpects) +} diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt index 80402c47f74..09694ec8a2a 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrlinker.kt @@ -31,12 +31,12 @@ import org.jetbrains.kotlin.ir.util.UniqId import org.jetbrains.kotlin.resolve.descriptorUtil.module class KonanIrLinker( - currentModule: ModuleDescriptor, - logger: LoggingContext, - builtIns: IrBuiltIns, - symbolTable: SymbolTable, - forwardModuleDescriptor: ModuleDescriptor?, - exportedDependencies: List + currentModule: ModuleDescriptor, + logger: LoggingContext, + builtIns: IrBuiltIns, + symbolTable: SymbolTable, + forwardModuleDescriptor: ModuleDescriptor?, + exportedDependencies: List ) : KotlinIrLinker(logger, builtIns, symbolTable, exportedDependencies, forwardModuleDescriptor, KonanMangler), DescriptorUniqIdAware by DeserializedDescriptorUniqIdAware { diff --git a/gradle.properties b/gradle.properties index a99de20bb88..9fe2ce0b52b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,12 +18,12 @@ buildKotlinVersion=1.3.70-dev-1070 buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.3.70-dev-1070,branch:default:any,pinned:true/artifacts/content/maven remoteRoot=konan_tests -kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.3.70-dev-2841,branch:default:any,pinned:true/artifacts/content/maven -kotlinVersion=1.3.70-dev-2841 +kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.4.0-dev-216,branch:default:any,pinned:true/artifacts/content/maven +kotlinVersion=1.4.0-dev-216 kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.3.70-dev-2841,branch:default:any,pinned:true/artifacts/content/maven -kotlinStdlibVersion=1.3.70-dev-2841 -kotlinStdlibTestsVersion=1.3.70-dev-2841 -testKotlinCompilerVersion=1.3.70-dev-2841 +kotlinStdlibVersion=1.4.0-dev-216 +kotlinStdlibTestsVersion=1.4.0-dev-216 +testKotlinCompilerVersion=1.4.0-dev-216 konanVersion=1.4.0 # A version of Xcode required to build the Kotlin/Native compiler. @@ -34,4 +34,3 @@ org.gradle.workers.max=4 # Uncomment to enable composite build #kotlinProjectPath= - diff --git a/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt b/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt index aaf7e4325b4..f48dbbbe0ad 100644 --- a/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt +++ b/klib/src/main/kotlin/org/jetbrains/kotlin/cli/klib/main.kt @@ -17,7 +17,9 @@ import org.jetbrains.kotlin.konan.target.Distribution import org.jetbrains.kotlin.konan.target.PlatformManager import org.jetbrains.kotlin.konan.util.DependencyProcessor import org.jetbrains.kotlin.library.unpackZippedKonanLibraryTo -import org.jetbrains.kotlin.konan.utils.KonanFactories.DefaultDeserializedDescriptorFactory +import org.jetbrains.kotlin.konan.util.KlibMetadataFactories +import org.jetbrains.kotlin.konan.utils.createKonanBuiltIns +import org.jetbrains.kotlin.backend.common.serialization.metadata.DynamicTypeDeserializer import org.jetbrains.kotlin.util.Logger import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf import org.jetbrains.kotlin.konan.library.KonanLibrary @@ -27,6 +29,8 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager import java.lang.System.out import kotlin.system.exitProcess +object KlibFactories : KlibMetadataFactories(::createKonanBuiltIns, DynamicTypeDeserializer) + fun printUsage() { println("Usage: klib ") println("where the commands are:") @@ -159,7 +163,7 @@ class Library(val name: String, val requestedRepository: String?, val target: St val storageManager = LockBasedStorageManager("klib") val library = libraryInRepoOrCurrentDir(repository, name) val versionSpec = LanguageVersionSettingsImpl(currentLanguageVersion, currentApiVersion) - val module = DefaultDeserializedDescriptorFactory.createDescriptorAndNewBuiltIns(library, versionSpec, storageManager, null) + val module = KlibFactories.DefaultDeserializedDescriptorFactory.createDescriptorAndNewBuiltIns(library, versionSpec, storageManager, null) val defaultModules = mutableListOf() if (!module.isKonanStdlib()) { @@ -170,7 +174,7 @@ class Library(val name: String, val requestedRepository: String?, val target: St logger = KlibToolLogger) resolver.defaultLinks(false, true, true) .mapTo(defaultModules) { - DefaultDeserializedDescriptorFactory.createDescriptor( + KlibFactories.DefaultDeserializedDescriptorFactory.createDescriptor( it, versionSpec, storageManager, module.builtIns, null) } } diff --git a/runtime/src/main/kotlin/kotlin/text/Appendable.kt b/runtime/src/main/kotlin/kotlin/text/Appendable.kt index 79c68c4ce03..74f572e022b 100644 --- a/runtime/src/main/kotlin/kotlin/text/Appendable.kt +++ b/runtime/src/main/kotlin/kotlin/text/Appendable.kt @@ -10,28 +10,28 @@ package kotlin.text */ public actual interface Appendable { /** - * Appends the specified character [c] to this Appendable and returns this instance. + * Appends the specified character [value] to this Appendable and returns this instance. * - * @param c the character to append. + * @param value the character to append. */ - actual fun append(c: Char): Appendable + actual fun append(value: Char): Appendable /** - * Appends the specified character sequence [csq] to this Appendable and returns this instance. + * Appends the specified character sequence [value] to this Appendable and returns this instance. * - * @param csq the character sequence to append. If [csq] is `null`, then the four characters `"null"` are appended to this Appendable. + * @param value the character sequence to append. If [value] is `null`, then the four characters `"null"` are appended to this Appendable. */ - actual fun append(csq: CharSequence?): Appendable + actual fun append(value: CharSequence?): Appendable /** - * Appends a subsequence of the specified character sequence [csq] to this Appendable and returns this instance. + * Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance. * - * @param csq the character sequence from which a subsequence is appended. If [csq] is `null`, - * then characters are appended as if [csq] contained the four characters `"null"`. - * @param start the beginning (inclusive) of the subsequence to append. - * @param end the end (exclusive) of the subsequence to append. + * @param value the character sequence from which a subsequence is appended. If [value] is `null`, + * then characters are appended as if [value] contained the four characters `"null"`. + * @param startIndex the beginning (inclusive) of the subsequence to append. + * @param endIndex the end (exclusive) of the subsequence to append. * - * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [start] or [end] is out of range of the [csq] character sequence indices or when `start > end`. + * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`. */ - actual fun append(csq: CharSequence?, start: Int, end: Int): Appendable + actual fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable } diff --git a/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt b/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt index abb3a0f9f18..c3f509e673e 100644 --- a/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt +++ b/runtime/src/main/kotlin/kotlin/text/StringBuilder.kt @@ -46,20 +46,20 @@ actual class StringBuilder private constructor ( actual override fun subSequence(startIndex: Int, endIndex: Int): CharSequence = substring(startIndex, endIndex) // Of Appenable. - actual override fun append(c: Char) : StringBuilder { + actual override fun append(value: Char) : StringBuilder { ensureExtraCapacity(1) - array[_length++] = c + array[_length++] = value return this } - actual override fun append(csq: CharSequence?): StringBuilder { + actual override fun append(value: CharSequence?): StringBuilder { // Kotlin/JVM processes null as if the argument was "null" char sequence. - val toAppend = csq ?: "null" + val toAppend = value ?: "null" return append(toAppend, 0, toAppend.length) } @UseExperimental(ExperimentalStdlibApi::class) - actual override fun append(csq: CharSequence?, start: Int, end: Int): StringBuilder = this.appendRange(csq, start, end) + actual override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder = this.appendRange(value, startIndex, endIndex) /** * Reverses the contents of this string builder and returns this instance. diff --git a/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt b/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt index 6da0cca1cf2..3f444e3f91e 100644 --- a/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt +++ b/shared/src/library/kotlin/org/jetbrains/kotlin/konan/library/impl/KonanLibraryImpl.kt @@ -36,9 +36,14 @@ open class TargetedLibraryImpl( override val targetList by lazy { access.inPlace { it: TargetedKotlinLibraryLayout -> - it.targetsDir.listFiles.map { - it.name - } + if (!it.targetsDir.exists) + // TODO: We have a choice: either assume it is the CURRENT TARGET + // or a list of ALL KNOWN targets. + access.target ?. let { listOf(it.visibleName) } ?: emptyList() + else + it.targetsDir.listFiles.map { + it.name + } } } @@ -100,4 +105,4 @@ fun createKonanLibrary( val bitcode = BitcodeLibraryImpl(bitcodeAccess, targeted) return KonanLibraryImpl(targeted, metadata, ir, bitcode) -} \ No newline at end of file +}