Commit Graph

55679 Commits

Author SHA1 Message Date
Mikhail Glukhikh b7da2f2ad8 FIR resolve: check early receivers on kotlin.* only
To provide more stable behaviour, the check introduced in the previous
commit is now applied only to extensions from kotlin.* package.
2019-06-19 22:48:52 +03:00
Mikhail Glukhikh 374b59dee3 FIR resolve: add early explicit receiver type check
Before this commit, explicit extension receiver type check was performed
during found candidates analysis (together with arguments type check etc.)
Now we do it just after candidate is found, and filter the candidate
out if explicit receiver type is inappropriate.

This commit slightly changes resolve semantics,
replacing WRONG_RECEIVER with UNRESOLVED_REFERENCE in certain situations.
However, it provides significant performance boost.
2019-06-19 22:45:15 +03:00
Mikhail Glukhikh d820b6ca52 More accurate messages about types in FirResolveBench 2019-06-19 22:45:14 +03:00
Dmitry Gridin 22a73bc09d ChangeFunctionSignatureFix: fix wrong result
#KT-32001 Fixed
2019-06-19 18:52:53 +07:00
Pavel Punegov 85210d5db0 Update zipTestData: use zip64, add coroutineTestUtil and remove stdlib tests 2019-06-19 14:43:36 +03:00
Natalia Selezneva b2109a2e65 Get rid of bunch file in AbstractScratchRunActionTest 2019-06-19 13:39:32 +03:00
Vladimir Dolzhenko 47a16cb252 Fixed and extended performance tests 2019-06-19 11:39:29 +02:00
Natalia Selezneva 5010824167 Fix compilation for 182, 183 branches 2019-06-19 12:17:23 +03:00
Alexander Podkhalyuzin 661d50de18 Do not search for Kotlin classes, when looking for Java classes 2019-06-19 11:03:54 +02:00
Natalia Selezneva 91ac38aaf4 Scratch: get editor from data context if possible 2019-06-19 11:29:15 +03:00
Natalia Selezneva a1564fe696 Scratch: get scratch expression using last commited version of document to avoid differences between PsiFile and Document 2019-06-19 11:29:14 +03:00
Natalia Selezneva 414f98aa29 Implement REPL Mode for scratches
^KT-27963 Fixed
2019-06-19 11:29:14 +03:00
Natalia Selezneva 8bc03e54f7 Scratch: do not clear inlays in onStart
This is needed for sequential executor
2019-06-19 11:22:20 +03:00
Natalia Selezneva b5b35a9037 Extract ScratchCompilingSession to allow calling executor multiple times 2019-06-19 11:22:20 +03:00
Natalia Selezneva 7038d9b8db Do not use ConfigurationFileCrcFactory comparing scratch content because it needed the document to be saved
Check only if new fragment is not empty to avoid recompilation on minor changes
2019-06-19 11:22:20 +03:00
Natalia Selezneva ab0877390b Use after line end inlays to avoid moving inlay on the next line pressing enter
^KT-29534 Fixed
2019-06-19 11:22:19 +03:00
Natalia Selezneva 5bff3ac927 Report errors from REPL to Scratch Console 2019-06-19 11:22:19 +03:00
Natalia Selezneva a6221cf594 Refactor scratch tests: add ability to set scratch options in test file 2019-06-19 11:22:19 +03:00
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