Commit Graph

36142 Commits

Author SHA1 Message Date
Mikhail Glukhikh 5947d49dee Multi-platform fix: no more errors for top-level impl fun / val / var in IDE 2016-12-19 14:55:49 +03:00
Alexander Udalov 63cc5d872d Minor, fix test data 2016-12-19 12:15:59 +03:00
Alexander Udalov da6c3c3231 Support header/impl enum classes
- prohibit constructors for header enum classes
- prohibit bodies for header enum entries
- all entries from header enum must be present in impl enum
2016-12-19 11:54:40 +03:00
Alexander Udalov 56d4ff0cad Support nested header/impl classes 2016-12-19 11:54:38 +03:00
Alexander Udalov a57455ce62 Relax requirements on function modifiers in multiplatform projects
Allow to implement header functions with external/tailrec/inline/infix/operator
functions
2016-12-19 11:53:39 +03:00
Alexander Udalov 64867409b7 Do not report errors on 'impl' declarations with -Xno-check-impl
Allow 'impl' modifier on a declaration even if it's not an implementation of
any header declaration
2016-12-19 11:50:54 +03:00
Alexander Udalov 0634782e47 Allow open impl class for final header class 2016-12-19 11:50:49 +03:00
Alexander Udalov 546e47dc44 Allow fake overrides and delegates to be impl for header declarations
Also fix a bug with matching supertype lists of header/impl classes
2016-12-19 11:50:40 +03:00
Alexander Udalov 7deaf8cc41 Allow impl class to be data class, allow impl constructor properties 2016-12-19 11:50:30 +03:00
Alexander Udalov 3e97c9fff9 Rename platform->header, definition->impl in test data 2016-12-19 11:50:21 +03:00
Denis Zharkov a1ac77d382 Support async iterator case with coroutines
Not all the `hasNext` operators return types is exactly Z,
suspend operators return boxed versions.

So the fix is just coercing result value after invoked function to Z
2016-12-19 11:07:33 +03:00
Denis Zharkov 1076397530 Minor. Simplify suspension point processing
Move type coercing logic from transformer to ExpressionCodegen.

For suspension points it's always guaranteed that values
returned from suspension points are always can be successfully casted
to appropriate type, because they cannot return SUSPENDED marker
(it gets processed via CoroutineTransformerMethodVisitor).
2016-12-19 11:07:32 +03:00
Denis Zharkov 5dbc04abbb Refine returns codegen for suspend functions
This change should make the logic a bit more simple.
For all suspend functions/coroutines treat them in expression codegen
like they return boxed version of the original type.

Everything works fine then, except Unit type functions:
their bodies must be generated just like they're VOID and then load
Unit on stack manually.
2016-12-19 11:07:32 +03:00
Dmitry Petrov 33ed98a0d3 Update typing rules for class literal expressions.
C::class : KClass<C>
expr: T => expr::class : KClass<out T>

NB: this means Obj::class : KClass<out Obj> for object Obj.
2016-12-19 10:41:49 +03:00
Alexey Tsvetkov 9fc3d0838e Fix references from test to main in Gradle JS plugin with default output file 2016-12-17 21:46:13 +03:00
Alexey Tsvetkov b14a0d543f Add references from test to main in multiplatform test project 2016-12-17 21:32:36 +03:00
Alexey Tsvetkov 6974cdf167 Avoid adding common sources to platform source set
If common sources are added to a platform source set,
then IDE sees common src dir as a source root in a platform project,
which is incorrect.
2016-12-17 21:32:32 +03:00
Alexey Tsvetkov c6586f2ac8 Fix mapping kotlin properties in JS plugin 2016-12-17 21:32:28 +03:00
Alexander Udalov f57bbeed58 Disable runtime versions consistency checker temporarily
It should be enabled back as soon as Kotlin-Version attribute is written to
manifests of runtime jars in the Maven build
2016-12-17 20:57:05 +03:00
Alexey Andreev 22ff7c6c45 JS: when translating content of js() function, rename all free references if they point to Kotlin local variable with the same name. See KT-15212 2016-12-17 12:12:36 +03:00
Ilya Gorbunov 5ee61702ee Do not deploy examples as artifacts to maven 2016-12-17 02:25:28 +03:00
Denis Zharkov 5ec62108ee Rename RestrictsSuspendExtensions -> RestrictsSuspension 2016-12-16 18:56:30 +03:00
Dmitry Jemerov 63785b5f66 Migration for JS extension functions and properties marked with @native/external
#KT-15269 Fixed
2016-12-16 15:36:55 +01:00
Dmitry Jemerov ace4407032 Add 1.1 EAP repository when creating a new Gradle project with 1.1 EAP
#KT-15293 Fixed
2016-12-16 14:49:18 +01:00
Mikhael Bogdanov 0949f55921 Uast update due to new diagnostic for delegation by 2016-12-16 13:17:29 +01:00
Mikhael Bogdanov 547704c179 'SubpackagesImportingScope' class update due to new diagnostic 2016-12-16 13:17:29 +01:00
Mikhael Bogdanov 761aa9df09 Report error when delegation method hides superttype override
#KT-12531 Fixed
2016-12-16 13:17:28 +01:00
Mikhael Bogdanov 686b698d80 Test data update 2016-12-16 13:17:27 +01:00
Denis Zharkov fa013f0bbf Add test on inference with SAM adapter
#KT-12144 Fixed
2016-12-16 15:01:19 +03:00
Denis Zharkov 01ff975cc0 Minor. Update tests on coroutines 2016-12-16 13:27:11 +03:00
Mikhael Bogdanov 004ff86bec Fix for KT-14774: Incorrect inner class modifier generated for sealed inner classes
#KT-14774 Fixed
2016-12-16 11:22:40 +01:00
Nikolay Krasko 654cecde69 Invalidate Script class finder caches as soon script classpath caches are invalidated (KT-14538)
#KT-14538 Fixed
2016-12-16 13:19:58 +03:00
Nikolay Krasko f7b60e64c9 Run invalidating script caches when reindexing is ready (KT-14538)
Explanation why it leads to red code after new project opening

 1. No script files are found after project initialization.
 2. KotlinScriptDependenciesIndexableSetContributor triggers caching classpath via getAllScriptsClasspath(). Empty classpath is cached.
 3. KotlinScriptDependenciesClassFinder.calcClassRoots() always get empty classpath.

 #KT-14538 In Progress
2016-12-16 13:19:56 +03:00
Nikolay Krasko 9759319da3 Revert "Filter out first dependency from module dependencies"
This reverts commit 868495437c.
2016-12-16 13:19:53 +03:00
Alexander Udalov 49de52e7ef Fix kotlinFunction for inline reified methods in reflection
Inline functions with reified type parameters are generated as private (see
AsmUtil.specialCaseVisibility), so we should treat them as "declared" in
reflection to look them up via getDeclaredMethod, not getMethod

 #KT-14721 Fixed
2016-12-16 13:12:41 +03:00
Alexander Udalov 3a0100f604 Minor, move isInlineOnlyOrReified to module descriptors 2016-12-16 13:12:40 +03:00
Ilya Gorbunov b2ccea87f3 Temporary workaround to generate functions with optional parameters with bodies in common code. 2016-12-16 04:36:30 +03:00
Ilya Gorbunov b72e5c038d Generate common headers to common/src/generated 2016-12-16 04:36:29 +03:00
Ilya Gorbunov 4f2593fb99 Add preprocessed JVM stdlib sources as common sources 2016-12-16 04:36:27 +03:00
Ilya Gorbunov 88a14056b7 Add hand-written headers for common stdlib 2016-12-16 04:36:25 +03:00
Ilya Gorbunov d381b56d47 Add module for common stdlib 2016-12-16 04:36:23 +03:00
Ilya Gorbunov 75992173b6 Unify Array.plus and plusElements function templates between JVM and JS. 2016-12-16 04:36:21 +03:00
Ilya Gorbunov 202cd81134 Unify Array.copyOf and copyOfRange function templates between JVM and JS. 2016-12-16 04:36:20 +03:00
Ilya Gorbunov 572a63f0e2 Unify Array.sort and sortWith function templates between JVM and JS.
Introduce new inline-only overload Array<out T: Comparable<T>>.sort().
2016-12-16 04:36:18 +03:00
Ilya Gorbunov e890cb137f Unify MutableList.reverse function template between JVM and JS 2016-12-16 04:36:16 +03:00
Ilya Gorbunov 085f476d22 Unify content[ToString, Equals, HashCode] function templates between JVM and JS 2016-12-16 04:36:14 +03:00
Ilya Gorbunov f3df648f4a Unify toTypedArray and asList templates between JVM and JS 2016-12-16 04:36:12 +03:00
Ilya Gorbunov 3d7e6e1996 Refactor stdlib generator: introduce platform-specialized properties.
Use Kotlin 1.1-M03 to utilize new language features.
2016-12-16 04:31:07 +03:00
Ilya Gorbunov c097f326fb Generate common headers of stdlib functions. What constitutes the header is yet to be decided. 2016-12-16 04:31:07 +03:00
Ilya Gorbunov 6ea1cde449 Generate additional sources for JS instead of copying them from JVM 2016-12-16 04:31:07 +03:00