Commit Graph

47900 Commits

Author SHA1 Message Date
Pavel V. Talanov 42f39a3ea4 Use older utility to fix compilation for as31 and 173 branches 2018-08-16 16:33:49 +02:00
Ilya Chernikov ac65aebb19 Direct mapping of script implicit receivers and env vars to parameters 2018-08-16 15:13:00 +02:00
Ilya Chernikov e1ee31b4ce Use linked hashmap in properties dsl - preserving order 2018-08-16 15:13:00 +02:00
Alexander Udalov ddb398645b Reformat modules 'metadata' and 'metadata.jvm', fix some inspections 2018-08-16 15:08:18 +02:00
Alexander Udalov 3345dc81fd Do not return field signature if there's none in the metadata
Otherwise this code behaves incorrectly on getter-only properties: it
returns a meaningless field signature whereas the property has no field.
It's hard to come up with an example of when this could matter in
compiler code, but it's very noticeable in kotlinx-metadata-jvm

 #KT-26188 Fixed
2018-08-16 15:05:19 +02:00
Alexander Udalov 3f32e1cce9 Do not serialize empty property signature to JVM metadata
This should have no effect on the correct code currently because all
properties have at least a getter, but may help in debugging problems
with serialized metadata for properties
2018-08-16 14:11:09 +02:00
Alexander Udalov bba25042b6 Fix generation of metadata for const val field in multi-file class
Metadata for declarations in multi-file classes is always written to the
corresponding parts, but fields for public const vals are generated into
the facade class.

Before this change, we ran generateBackingField only to generate the
const val field in the facade (because isBackingFieldOwner is true only
for the facade). Besides generating the actual field,
generateBackingField also stores the mapping to the FIELD_FOR_PROPERTY
slice, which is used later in the serializer to serialize the correct
JVM signature of the field to the metadata. However, the mapping was
stored to the incorrect binding map! Namely, the map from the same
ClassBuilder that is used to generate the class, and that is the facade
class builder. But the metadata needs to be generated to the part class,
not the facade.

Surprisingly, there is a test at
reflection/multifileClasses/javaFieldForVarAndConstVal.kt that checks
that kotlin-reflect is able to load the field signature of a const val
in a multi-file class, which is the main use case of this information,
and it passed before this change. The reason the test passed is that
KPropertyImpl.javaField uses JvmProtoBufUtil.getJvmFieldSignature which
mistakenly treats the absence of the field signature in the proto as the
hint that it may be computed naively (just the property's name + naively
mapped type), whereas in fact the field signature was missing
completely. (The fact that absence of a message may mean two things is
certainly a shortcoming of the metadata format and should be revisited
in the future.) This never led to any problem in the real world because
it's easy to prove that the field signature of a const val can always be
computed naively.

After this change, we now run generateBackingField twice: for the
facade's class builder, and for the part's class builder. The actual
field is only generated in the former case. But the mapping computed in
the latter case is used correctly in JvmSerializerExtension to store the
field signature to metadata. Also refactor
generateSyntheticMethodIfNeeded in the similar way, to reduce the number
of `if`s.
2018-08-16 14:11:09 +02:00
Alexander Udalov b9594988ea Do not read property getter/setter signature if it's empty
This has no effect on the correct code currently, but will help in
debugging when changing the serialized metadata for properties.

For example, if after some change an empty propertySignature extension
is written for Property (it's possible for PropertyDescriptor without
getter or setter and without backing field), we now won't try to read a
missing getter message when loading annotations on property getter. In
protobuf, reading a missing message will result not in an exception, but
in a "default" message being returned, which makes no sense in our case
because it would simply be read as a getter signature with both "name"
and "desc" equal to 0 (i.e. the first entry in the string table)
2018-08-16 14:11:09 +02:00
Dmitry Petrov b6e3218ca2 Use mapping mode for inline class underlying type without wrapping 2018-08-16 15:03:50 +03:00
Dmitry Petrov 06ef8824b6 Minor: reformat 2018-08-16 15:03:50 +03:00
Pavel V. Talanov 5ad8405893 Tweak test data so MultiFileHighlighting does not fail
Actually this test has to be reviewed
Current failures are caused by change in platform API
2018-08-16 14:03:01 +02:00
Pavel V. Talanov 8e470c7c4c Fix test data
Order of members returned by platform changed
Fix test files so test result would not depends on this order
2018-08-16 14:03:01 +02:00
Pavel V. Talanov b59f134f78 Fix completing members for receivers shadowed by DslMarker
#KT-20396 Fixed
2018-08-16 13:59:38 +02:00
Pavel V. Talanov 0c1d25d5ac Completion: when Unit is expected do not prioritize by return type
Decide on completion order by other factors
Previously would prefer callable that return Unit if Unit is the expected type
    leading to strange completion order

 #KT-25588 Fixed
2018-08-16 13:59:38 +02:00
Pavel V. Talanov 51681d57c8 Minor: toString() for CompoundWeight to improve test results readability 2018-08-16 13:59:38 +02:00
Pavel V. Talanov b51c021f56 Dsl completion: assign high priority for dsl elements that are members 2018-08-16 13:59:37 +02:00
Pavel V. Talanov af2a6a5096 Support dsl highlighting for object references 2018-08-16 13:59:37 +02:00
Pavel V. Talanov f80b85c282 Minor, refactor TypeKindHighlightingVisitor 2018-08-16 13:59:37 +02:00
Pavel V. Talanov 3d91d4b865 Minor: expand dsl highlighting test cases to cover member functions 2018-08-16 13:59:37 +02:00
Pavel V. Talanov e9a9f2a1aa Dsl highlighting: support highlighting properties
Fix properties not being highlighted
Fix test infrastructure to verify actual output of highlighting visitors
2018-08-16 13:59:37 +02:00
Pavel V. Talanov c250f7fca4 Add debug information on any of ResolutionFacade API failures 2018-08-16 13:56:28 +02:00
Sergey Rostov f09364e654 Kotlin facet UI, JS: Hide "Enable incremental compilation (experimental)".
This option is project-wide only, so it should be visible only in project settings.
#KT-26095 Fixed.
2018-08-16 10:51:36 +03:00
Ilya Gorbunov ebc64da52a Update EXPECTED_REACHABLE_NODES after introducing top-level comparator
#KT-18067
2018-08-15 21:28:57 +03:00
Ilya Gorbunov ed53983e1e Add support for CASE_INSENSITIVE_ORDER in JS and common
#KT-18067
2018-08-15 21:28:54 +03:00
Ilya Gorbunov 6866f5d19a Move test and cover more cases of string comparison
#KT-18067
2018-08-15 21:28:50 +03:00
Ilya Gorbunov 27dde5f730 String.compareTo: SinceKotlin in JS and common, restore default parameter value in JVM
Default parameter is required to generate docs with Dokka for now.

#KT-18067
2018-08-15 21:28:47 +03:00
Toshiaki Kameyama f05a19aafb JS stdlib: implement String.compareTo with ignoreCase
#KT-18067 Fixed
2018-08-15 21:28:44 +03:00
Alexey Sedunov d194893012 MPP: Add production module dependencies to the test one (new MPP import)
#KT-25985 In Progress
2018-08-15 18:21:53 +03:00
Alexey Sedunov 443f8b6f02 Minor: Fix test data 2018-08-15 18:21:53 +03:00
Svyatoslav Kuzmich f5a80a30f7 Mute and unmute tests 2018-08-15 18:20:07 +03:00
Sergey Igushkin d13ca38296 Relax some restrictions on Gradle dependency configurations in new MPP
* Set canBeConsumed = false only on those configurations that have this
  flag according to the Gradle Java plugins. This saves us from breaking
  existing build scripts but introduces ambiguity between consumable
  configurations (e.g. between `apiElements`, `compile`, `runtime`). See
  the solution in the next point.

* Don't set the Kotlin platform attribute on configurations that are
  not meant for consuming in other projects or resolving directly. This
  change hides these configurations from Gradle's variant aware
  dependency resolution and therefore prevents ambiguity

(cherry-picked from 81f2c48f)
2018-08-15 17:48:44 +03:00
Georgy Bronnikov 00da193167 Introduce IrDeclarationWithVisibility 2018-08-15 16:56:16 +03:00
Dmitry Petrov 8e95ecb821 Use underlying type when computing type mapping mode for inline classes 2018-08-15 15:37:46 +03:00
Dmitry Petrov 948e72f653 Inline classes can only implement interfaces 2018-08-15 15:32:50 +03:00
Ilmir Usmanov 1c098bf5cf Minor. Fix test 2018-08-15 14:23:33 +03:00
Ilmir Usmanov b4189d9e85 Minor. Use more granular assertion levels in assertion tests 2018-08-15 14:23:30 +03:00
Mikhael Bogdanov 1a1bb53381 Update IR text test
Additional implicit coercions to unit was added
2018-08-15 14:18:15 +03:00
Ilmir Usmanov 300876348a Fix line numbers generation for coerced primitives
in coroutines
 #KT-25076: Fixed
2018-08-15 13:47:45 +03:00
Ilmir Usmanov a470fd21ca Eliminate only first {ASTORE, ALOAD} in locals elimination
of ALOAD.
 #KT-25912: Fixed.
2018-08-15 13:45:24 +03:00
Svyatoslav Kuzmich ff70b837ee [JS IR BE] Support local delegated properties 2018-08-15 13:35:14 +03:00
Svyatoslav Kuzmich 392ad521fd [JS IR BE] Reflection support 2018-08-15 13:35:14 +03:00
Mikhail Glukhikh 1471fe08d7 Minor rename in if-then utils 2018-08-15 12:36:01 +03:00
Mikhail Glukhikh 5b77def0e0 "if-then to safe access": treat transformation to 'let' as intention
Related to KT-7675
2018-08-15 12:36:01 +03:00
Toshiaki Kameyama f5cfec4a91 "if-then to safe access" inspection: support call expression -> let
#KT-7675 Fixed
2018-08-15 12:36:01 +03:00
Toshiaki Kameyama 2dcbf6aa34 Introduce "Redundant return label" inspection #KT-25270 Fixed 2018-08-15 12:36:01 +03:00
Toshiaki Kameyama b91f30ab15 Suspicious callable reference: no quick fix with invalid reference type
#KT-23467 Fixed
2018-08-15 12:36:00 +03:00
Leonid Startsev 0ac969a617 Attempt to make loading of compiler plugins from kotlin-platform-native Gradle plugin
Moved SubpluginEnviroment to separate file and made public some methods
KotlinNativeCompile task now extends AbstractCompile so it could be passed to SubpluginEnviroment.loadSubplugins
KotlinNativeBasePlugin now declares kotlinCompilerPluginClasspath configuration
2018-08-15 12:19:04 +03:00
Mikhael Bogdanov 494828f4cf Unmute jvm ir-tests 2018-08-15 10:26:28 +03:00
Mikhael Bogdanov 6d915bd68c Use original descriptors on implicit coercion to unit generation 2018-08-15 10:26:03 +03:00
victor.petukhov e01e832acd Add gradle task to print spec tests statistic by spec sections 2018-08-14 17:34:38 +03:00