Commit Graph

55661 Commits

Author SHA1 Message Date
Alexander Podkhalyuzin b59bd9d6a6 Faster component loading (better cache data structures) 2019-06-19 10:13:09 +02:00
Mikhail Zarechenskiy 796cdea50e [NI] Require all proper constraints for Exact return type
Consider call `foo(bar())` where bar() returns some type variable `T`;
 We had a contract that call `bar` can be completed without completion
 of foo (type variables can be inferred from the current context) if `T`
 has at least one proper lower constraint (ProperType <: T).
 Indeed, new constraints can be added only as upper ones, so there is
 no need to grow constraint system.

 Unfortunately, we have Exact annotation that is used on return type of
 elvis. Now, consider the following situation:
 ```
 fun foo(a: Any) {}
 fun bar(e: T): @Exact T

 foo(bar("str"))
 ```

 Here, because of Exact annotation, constraint with `Any`-type will be
 added as an equal one => our prerequisite that there will be no new
 lower constraints is false. `bar("str")` is inferred to Any in OI,
 this seems conceptually wrong, but it's another topic of discussion.

 In NI we can't just grow constraint system to use outer call because
 of another important use-case:
 ```
 fun <T> generic(i: Inv<T>) {}

 fun test(a: Inv<*>?, b: Inv<*>) {
     generic(a ?: b)
 }
 ```

 Common constraint system for these two calls can't be solved
 (fundamentally) for this example, only if (a ?: b) and generic(result)
 are computed separately.

 So, to mitigate initial issue, we'll grow constraint system only if
 there is at least one non-proper constraint.

 #KT-31969 Fixed
2019-06-19 11:07:31 +03:00
Mikhail Zarechenskiy ca997de6a7 [NI] Test data to understand changes in the next commit
##KT-31969 In Progress
2019-06-19 10:47:05 +03:00
Roman Artemev 50ad21e388 [IR BE] Fix symbol remapping for IrField/IrProperty
- Use appropriate wrapped descriptor
 - Add test
2019-06-19 10:24:15 +03:00
Vladimir Dolzhenko f11a87e0c5 Revert "Do not resolve import to get imported name"
This reverts commit 60c3e644
2019-06-19 09:20:28 +02:00
Dmitry Gridin 7040639c38 Fix false positive "Not-null extension receiver of inline function can be made nullable" with operator fun invoke
#KT-25786 Fixed
2019-06-19 12:16:41 +07:00
Ilya Gorbunov eae1813ead stdlib-js(-v1/-ir): rename source files to avoid duplicates in sources
Prohibit having duplicates in sources jar and rename those source files,
that clash with the same named source files coming from
the common js source root.

Relates to KT-31965
2019-06-18 20:03:04 +03:00
Ilya Gorbunov 5bafba6bff stdlib-js-ir: preserve source directory structure of common js sources 2019-06-18 19:58:47 +03:00
Ilya Gorbunov ff9d2744ce Provide conversions between Kotlin and Java time durations 2019-06-18 19:49:50 +03:00
Ilya Gorbunov d7252548fc Add symmetric number * duration operators 2019-06-18 19:49:50 +03:00
Ilya Gorbunov a2b1c537af Change Duration.toString scientific exponent formatting
- use 'e+' for positive exponents in scientific format
2019-06-18 19:49:35 +03:00
Ilya Gorbunov a5b7c270ae Change Duration.toString(unit, decimals) formatting
- switch to scientific notation when value is too big (greater than 1e14)
- allow at most 12 decimals, larger values are coerced to 12
- use scientific format with exactly two decimals in mantissa in JVM
2019-06-18 19:49:35 +03:00
Mikhail Zarechenskiy 5cf7c7e5bf [NI] Fix composite substitution for stubbed type in builder-inference
#KT-32038 Fixed
2019-06-18 19:38:04 +03:00
Mikhail Zarechenskiy 7df13c986e [NI] Coerce to Unit expression in last block with explicit Unit
#KT-32037 Fixed
2019-06-18 19:38:02 +03:00
Alexander Podkhalyuzin 25342240b5 Do not resolve top level annotation even in case of inner class conflict 2019-06-18 17:55:50 +02:00
Alexander Podkhalyuzin 60c3e6442f Do not resolve import to get imported name 2019-06-18 17:51:23 +02:00
Denis Zharkov 9d02fe564c FIR: Avoid calling ClassId::asString from ConeTypeContext 2019-06-18 17:20:23 +03:00
Sergey Rostov 7d7f4a8783 Gradle, JS: fix TCServiceMessageOutputStreamHandlerTest on windows 2019-06-18 15:11:08 +03:00
Alexander Podkhalyuzin 4babde5b46 Faster startup avoiding unnecessary class loading in HelloWorld.java 2019-06-18 12:08:28 +02:00
Alexander Podkhalyuzin c853ae49a2 Faster startup avoiding unnecessary class loading 2019-06-18 12:08:04 +02:00
Denis Zharkov f7d0be980b FIR: Optimize ConeTypeContext::isIntegerLiteralType
See ConeTypeContext::isIntegerLiteralTypeConstructor
2019-06-18 11:55:15 +03:00
Denis Zharkov 3c8ed21e59 Optimize ConstraintInjector::isMyTypeVariable
Do not look into the map for constructors that are not
type variables
2019-06-18 11:55:15 +03:00
Denis Zharkov b43f717f6d Optimize AbstractTypeChecker::hasNothingSupertype
It doesn't make sense to go through all supertypes because
Nothing is a final class
2019-06-18 11:55:15 +03:00
Denis Zharkov 115ab38423 FIR: Optimize ConeTypeContext::captureFromArguments 2019-06-18 11:55:15 +03:00
Simon Ogorodnik 2c5bd46a97 [FIR] Handle non-kotlin class results from findKotlinClassOrContent 2019-06-18 11:36:42 +03:00
Simon Ogorodnik 2f53bd24dd [FIR] Reorder providers to make builtins load first 2019-06-18 11:34:18 +03:00
Simon Ogorodnik 03c3469a14 [FIR] Enhance caches in providers 2019-06-18 11:33:11 +03:00
Simon Ogorodnik f88fafea9d [FIR] Use proper collections for override scope 2019-06-18 11:14:58 +03:00
Simon Ogorodnik 321e948eca [FIR] Improve typing to get rid of cast 2019-06-18 11:14:57 +03:00
Simon Ogorodnik 95409b35ca [FIR] Use abstract classes for FIR scopes 2019-06-18 11:14:56 +03:00
Simon Ogorodnik 810fa9c171 [FIR] Make session & symbolProvider abstract classes 2019-06-18 11:14:55 +03:00
Simon Ogorodnik 5a06027c53 [FIR] Avoid instanceof List in transformInplace 2019-06-18 11:14:54 +03:00
ilgonmic 024636f704 Gradle, JS, webpack: run js directly (don't use bin script)
On windows, bin script wrapped with bashsh and cmd shell, so node failed
 to run it

#KT-31985 Fixed
2019-06-18 10:50:41 +03:00
ilgonmic a4427773a5 Gradle, JS, webpack: escape strings inside webpack config
#KT-31985
2019-06-18 10:50:40 +03:00
Ilya Gorbunov aa69933ee0 Update EXPECTED_REACHABLE_NODES
DCE doesn't remove DurationUnit and some other kotlin.time stuff in these cases
2019-06-18 04:02:36 +03:00
Ilya Gorbunov 58b04c7974 Add remaining docs for Duration members, runnable samples for toString 2019-06-18 04:02:35 +03:00
Ilya Gorbunov ffd9d8c71d Remove unneeded buildString from Duration.toString 2019-06-18 04:02:35 +03:00
Ilya Gorbunov 155dfeaf35 Generate kotlin.time package public API dump 2019-06-18 04:02:35 +03:00
Ilya Gorbunov c66740a7ed Explicit public visibility, SinceKotlin and ExperimentalTime status
Use file level ExperimentalTime opt-in in tests.
2019-06-18 04:02:35 +03:00
Ilya Gorbunov 16111ab79f Opt-in for Experimental/UseExperimental annotation usage in tests 2019-06-18 04:02:34 +03:00
Ilya Gorbunov 3b989cc815 Avoid using 'D' component in ISO duration string representation
Days in ISO have nominal duration, they are not always equal to 24H
2019-06-18 04:02:34 +03:00
Ilya Gorbunov 6dbc2eeb90 Provide more efficient ClockMark implementation
Do not use default 'plus' operator implementation, that creates a wrapping
AdjustedClockMark instance, create instance of the same type instead.
2019-06-18 04:02:34 +03:00
Ilya Gorbunov 8c730e180c Make ClockMark an abstract class instead of an interface 2019-06-18 04:02:34 +03:00
Ilya Gorbunov 04ec90164e Use ThreadLocals to cache DecimalFormat instances 2019-06-18 04:02:34 +03:00
Ilya Gorbunov 368452748b Move convertDurationUnit into Duration companion 2019-06-18 04:02:33 +03:00
Ilya Gorbunov ca10d13f34 Rename Duration storage property to 'value' 2019-06-18 04:02:33 +03:00
Ilya Gorbunov 365cbb94cd Change Duration.absoluteValue to property 2019-06-18 04:02:33 +03:00
Ilya Gorbunov 3f7a0d0845 Rename DurationMeasured to TimedValue, withMeasureTime to measuredTimeValue
Add measureTime docs
2019-06-18 04:02:33 +03:00
Ilya Gorbunov 9deac2a591 Rename withComponents to toComponents and add two overloads of them 2019-06-18 04:02:33 +03:00
Ilya Gorbunov 796ad29637 Add shortcuts to convert duration to milliseconds and nanoseconds 2019-06-18 04:02:32 +03:00