Commit Graph

44047 Commits

Author SHA1 Message Date
Dmitry Petrov f4ed4ec9d9 Distinguish numeric comparisons in FE, store info in BindingContext
When we an equality or comparison operator expression
with both arguments "statically known to be of primitive numeric types"
(that is, either inferred type T for an operand is a primitive numeric
type, or a smart cast to a primitive numeric type T is possible in the
corresponding context), comparisons should be performed on primitive
numbers with corresponding widening conversions.

This differs from default 'equals' and 'compareTo' implementations in
case of floating-point numbers: for Float and Double, IEEE 754
comparisons are used instead of total order implemented by j.l.Float and
j.l.Double.

Examples:

fun ex1(x: Double, y: Double) = x < y
-- will use IEEE 754 comparison for Double, because
   both 'x' and 'y' have type Double

fun ex2(x: Double, y: Any) = y is Double && x < y
-- will use IEEE 754 comparison for Double, because
   smart cast to Double is possible for 'y'

fun ex3(x: Comparable<Double>, y: Double) = x is Double && x < y
-- will use IEEE 754 comparison for Double, because
   smart cast to Double is possible for 'x',
   even though corresponding operator convention is resolved to
   'Comparable<Double>#compareTo(Double)' (which would use total order)

fun ex4(x: Any, y: Any) = x is Double && y is Int && x < y
-- will use IEEE 754 comparison for Double with 'y' promoted to Double,
   because smart cast to Double is possible for 'x',
   and smart cast to Int is possible for 'y',
   and least common primitive numeric type for Double and Int is Double.
2018-02-07 14:30:59 +03:00
Alexey Sedunov 930e51e30e Misc: Update test data due to changes in 'actual' constructor checking
Now actual class constructor is considered an implementation
only if it has 'actual' modifier itself
2018-02-07 14:13:16 +03:00
Nicolay Mitropolsky 91a4bbed2e Uast: KotlinUNestedAnnotation with light annotation (IDEA-185890) 2018-02-07 10:17:40 +03:00
Nicolay Mitropolsky cb05baa02b LightAnnotations: wrapping nested annotations with KtLightAnnotationForSourceEntry 2018-02-07 10:17:40 +03:00
Nicolay Mitropolsky 48ea52def1 Uast: KotlinUNestedAnnotation for processing nested annotations (IDEA-185890) 2018-02-07 10:17:40 +03:00
Yan Zhulanow 1f81c0cdfe Kapt: Fix compilation errors when the referenced class has '$' in the beginning of its name (KT-22493) 2018-02-06 22:16:01 +03:00
Yan Zhulanow 5fc9c5671c Kapt: Escape nested comments in doc comments (KT-22469) 2018-02-06 22:16:01 +03:00
Yan Zhulanow abda4bfb57 Kapt: Remove comments inside enum values (KT-22350) 2018-02-06 22:16:01 +03:00
Yan Zhulanow a171874b2f Fix "Illegal Android Identifier" inspection reports non-instrumentation unit tests (KT-22168) 2018-02-06 22:16:00 +03:00
Yan Zhulanow 4e8969e1c2 Kapt: Fix array of anonymous type handling (KT-22468) 2018-02-06 22:16:00 +03:00
Yan Zhulanow 144ec9285f Minor: Get rid of duplicating option descriptions in Kapt plugin 2018-02-06 22:16:00 +03:00
Yan Zhulanow e38a41d2f2 Evaluate: Fix compiling evaluator issues led to improper expression caching
1. Do not save a ClassLoader reference inside the context, as we don't use it anyway after evaluation.
This is to avoid custom ClassLoader nesting.

2. Do not use 'findClass()' as it caches the loaded classes and always returns the first evaluated class if it's in cache.
2018-02-06 22:16:00 +03:00
Yan Zhulanow da74bcbcc0 Evaluate: Support dex in newer Android build tools 2018-02-06 22:16:00 +03:00
Yan Zhulanow 7c7c929b0e Kapt: Disable location mapping by default, allow to enable it manually 2018-02-06 22:16:00 +03:00
Yan Zhulanow 5668a7af92 Kapt: Replace original Javac diagnostic messages with those with Kotlin location mapped
There is no Messages dialog in newer versions of IDEA/Android Studio in which the error messages were mapped before. The new Build window shows only the original locations, so now we need to replace Java file diagnostics with ones mapped to Kotlin source files.

The side effect is that diagnostics on the same locations are automatically merged.
2018-02-06 22:16:00 +03:00
Yan Zhulanow b0e97de8a8 Kapt: Move line metadata to .kaptMetadata external files (KT-22386)
Placing location table inside .java file triggers annotation processor to run on each line table modification (even when the stub declarations themselves are the same). So we move it to the separate file.
2018-02-06 22:16:00 +03:00
Yan Zhulanow bf9eed931b Parcelable: Fix 'Simple' test (new boolean serializer) 2018-02-06 22:15:59 +03:00
Yan Zhulanow 145ddf3b1f Parcelable: Add CREATOR field (and other generated declarations) in light classes (KT-19300, KT-19853) 2018-02-06 22:15:59 +03:00
Ilya Gorbunov 90dff281ba Actualize ReadMe files
- Actualize build requirements and steps
- Extract Gradle plugin readme to the corresponding folder
- Rewrite Libraries and Maven Tools readme

#KT-20995 Fixed
2018-02-06 21:17:58 +03:00
Ilya Gorbunov aa74f163f7 Minor: improve table formatting 2018-02-06 21:17:57 +03:00
Ilmir Usmanov ad385f42a9 Fix continuaion retrieval on generated coroutineContext intrinsic code
Use fake continuation instead on real one in JVM BE.
Pass continuation parameter to closure generator in JS BE.

 #KT-22577: Fixed
2018-02-06 21:14:37 +03:00
Sergey Igushkin e8cd8b566e Delay kapt dependencies resolution from configuration phase
Store kapt configurations instead of classpath files in the tasks
Delay wrapping kapt subplugin options to task execution (when the
classpath can be safely resovled)

Issue #KT-18821 Fixed
2018-02-06 21:01:57 +03:00
Nicolay Mitropolsky 8ac95b54a2 Uast: support for Kotlin array literals 2018-02-06 17:53:17 +03:00
Alexey Sedunov 358bc62fc1 Minor: Regenerate tests 2018-02-06 17:06:03 +03:00
Alexander Udalov 12e31cedfd Write lambdaClassOriginName for lambdas copied during inline
Similarly to anonymousObjectOriginName which is written for copied
anonymous objects

 #KT-21320
2018-02-06 13:05:22 +01:00
Alexander Udalov 6da3f37fc3 Write anonymousObjectOriginName for classes copied during inline
#KT-21320
2018-02-06 13:05:22 +01:00
Mikhail Glukhikh 81122ed236 Fix a pack of broken IDE action tests
Related to KT-20281.
For Java resolve we can use also resolve with 'null' platform,
which is possible situation in tests.
2018-02-06 15:02:38 +03:00
Alexander Podkhalyuzin 09d167eafb Ask just extensions, not in some area #KT-21978 Fixed 2018-02-06 14:58:18 +03:00
Alexey Sedunov c602c51642 Slicer: Sort tree nodes to produce stable test data 2018-02-06 14:23:20 +03:00
Alexey Sedunov adca8eb7f1 Rename: Substitute synthetic expression parent before analysis
This fixes rename conflicts test
2018-02-06 14:23:20 +03:00
Alexey Sedunov 049439ce1d Rename: Update test data (follow-up for unnecessary reformatting fix) 2018-02-06 14:23:20 +03:00
Alexey Sedunov d51da8bafd Misc: Fix Android SDK path in Gradle import tests 2018-02-06 14:23:19 +03:00
Mikhail Glukhikh 7995ae05c5 Introduce inspection for redundant not-null extension receiver of inline
Related to KT-22303
2018-02-06 14:17:01 +03:00
Mikhael Bogdanov ad48099ca6 Move java 8 tests to java8 folder 2018-02-06 10:32:14 +01:00
Dmitry Savvinov 7e512ba018 Enable contracts in the 'compiler' module 2018-02-06 10:58:47 +03:00
Mikhail Glukhikh 19beaf57a7 JVM facade: for Java resolve, always use JvmPlatform resolver
So #KT-20281 Fixed
2018-02-06 09:50:10 +03:00
Mikhail Glukhikh c90056f8c4 Introduce inspection for nullable extension receiver of inline function
So #KT-22303 Fixed
2018-02-06 09:50:09 +03:00
Mikhail Glukhikh 08d3f20e09 Reformat: AbstractMultiModuleHighlightingTest 2018-02-06 09:50:08 +03:00
Mikhail Glukhikh 3ba6b70f73 Show expect / actual gutter even for incomplete compatibility
So #KT-18445 Fixed
So #KT-21115 Fixed
2018-02-06 09:50:00 +03:00
Mikaël Peltier a2a3043607 KT-18731 Use reference equality to compare enums
Fix of https://youtrack.jetbrains.com/issue/KT-18731
2018-02-05 18:34:44 +03:00
Pavel V. Talanov bc54c95bc3 JavaResolveExtension: create facade by original element
Fixes semantic difference erroneously introduced in c030a047aa
 #KT-22593 Fixed
2018-02-05 16:26:47 +01:00
Pavel V. Talanov 7b8d501670 Dsl highlighting: Provide gutter for marker annotation definition
Allows to jump to corresponding page in 'color and font' settings
2018-02-05 16:22:23 +01:00
Pavel V. Talanov 0d5d826bc5 Dsl highlighting: reasonable default colors 2018-02-05 16:22:22 +01:00
Pavel V. Talanov b9c832a952 Implement custom highlighting for dsls
A declaration is considered a part of dsl if it's marked with
    a marker annotation (which is in turn must be marked as @DslMarker)
Highlighting attributes are then chosen randomly from a preset list
    based on marker annotation fqname
2018-02-05 16:22:20 +01:00
Pavel V. Talanov 5ab00ee9f7 HighlighterExtension can provide custom highlighting for calls 2018-02-05 16:22:19 +01:00
Alexander Udalov 91a9038b2f Regenerate Gradle options
After f9e195351a
2018-02-05 16:17:30 +01:00
kenji tomita 1875d129ea Inspection to get rid of unnecessary ticks in references #KT-18124 Fixed 2018-02-05 17:31:08 +03:00
Alexander Udalov 9e500831dd Allow expect/actual annotation constructors to have default values
When a parameter has a default argument value both in the expected
annotation and in the actual annotation, they must be equal. This check
has been only implemented for the case when actual annotation is Kotlin
source code, and NOT a Java class coming from an actual typealias. The
latter case would require a bit more work in passing a platform-specific
annotation-value-reading component to ExpectedActualDeclarationChecker,
and is therefore postponed.

For now, Java annotations that are visible through actual type aliases
cannot have default argument values for parameters which already have
default values in the expected annotation declaration

 #KT-22703 Fixed
 #KT-22704 Open
2018-02-05 14:13:32 +01:00
Alexander Udalov 71fe8c02a3 Fix rendering of type aliases
- render 'actual' modifier if it's present
- do not render a space after type parameter list
2018-02-05 13:38:06 +01:00
Zalim Bashorov e0245a9dc7 KJS: support default arguments for expected declarations 2018-02-05 13:38:06 +01:00