Commit Graph

16860 Commits

Author SHA1 Message Date
Alexander Udalov 1d71c19b42 Serialize .kotlin_metadata binary files per source file
Do not serialize everything in the same package to the same file (as is done
for built-ins) because this approach is unfriendly to incremental compilation,
which is going to be supported in the future. Instead, similarly to JVM
serialize each class to its own file, and each source file with top-level
callables/typealiases to its own file.

E.g. if a file named test.kt contains a class Foo and some
functions/properties, the output will contain two files: TestKt.kotlin_metadata
and Foo.kotlin_metadata. Each one of this files contains the serialized
BuiltIns message (see builtins.proto)
2016-11-25 20:50:10 +03:00
Alexander Udalov ec03c6decb Introduce K2MetadataCompiler, extract MetadataSerializer out of BuiltInsSerializer
K2MetadataCompiler is a compiler facade similar to K2JVMCompiler and
K2JSCompiler and it produces .kotlin_metadata files. Each .kotlin_metadata file
contains the binary data which is a serialized BuiltIns protobuf message.

There's no 'kotlinc-***' script yet though, so to run this compiler currently
invoke this:

    KOTLIN_COMPILER=org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler kotlinc
2016-11-25 20:50:09 +03:00
Dmitry Petrov 3d2696c81b KT-13440 Bound callable references in reflection 2016-11-25 16:11:18 +03:00
Dmitry Petrov 5879e201cd Proper equality comparison for bound callable references represented as reflection objects
(including references to property accessors).
2016-11-25 14:49:24 +03:00
Dmitry Petrov 3dd0c9d1c7 Equality comparison for bound callable references takes into account bound receiver.
Fixed KT-14939: use expected receiver type when generating receiver code in get/set methods for bound property references.
Otherwise we have VerifyError for bound receiver 'null' of type 'Nothing?', which is mapped to 'java.lang.Void'.

TODO: proper equality comparison for property accessors ('x::prop.getter', 'x::prop.setter').
2016-11-25 14:49:24 +03:00
Alexey Andreev 66c78be10f JS: don't optimize RTTI when possible, i.e. don't remove is and as when object is known at compile time to have type in RHS of expression. Substitute kotlin.Any with Object. Fix #KT-7665, #KT-7664 2016-11-25 14:08:13 +03:00
Alexey Andreev c581ec6dd6 JS: fixes after code review 2016-11-25 14:07:31 +03:00
Alexey Andreev 46242f4430 JS: when RHS of as cast is non-nullable native interface, check LHS for null 2016-11-25 14:07:30 +03:00
Alexey Andreev 2eb54f234c JS: prohibit passing native interfaces to reified type parameters 2016-11-25 14:07:29 +03:00
Alexey Andreev acf7fcaebf JS: prohibit is checks against native interfaces. Warn about casts to native interfaces. Fix #KT-14037, fix #KT-14038 2016-11-25 14:07:29 +03:00
Mikhail Glukhikh 9c75324188 Minor: rename in KtPsiFactory 2016-11-24 15:26:30 +03:00
Mikhail Glukhikh b111d1ba69 Convert reference to lambda intention introduced #KT-13393 Fixed 2016-11-24 15:26:18 +03:00
Mikhail Glukhikh 14787e3583 VarianceChecker: correct handing of nested classes and their methods #KT-14733 Fixed 2016-11-24 14:22:23 +03:00
Dmitry Jemerov 763782083c Implement KtLightTypeParameter.isEquivalentTo() without referencing delegate (this is faster and more correct) 2016-11-23 18:29:25 +01:00
Dmitry Jemerov 956e1c70dc Provide toString() for classes that extend GlobalSearchScope (to diagnose package fragment errors) 2016-11-23 18:29:24 +01:00
Dmitry Jemerov 32be1940be KtFile.getPackageFqNameByTree() never tries to access stub (EA-82168) 2016-11-23 18:29:24 +01:00
Dmitry Jemerov c56a72d442 Retrieve virtual file for PsiFile via FileViewProvider, which always has a non-null vFile (EA-89047 - assert: LightClassDataProvider.getRepresentativeVirtualFile) 2016-11-23 18:29:23 +01:00
Dmitry Jemerov 89313b3495 Fix exception when companion object is on the top level of a file (EA-89388 - CCE: LightClassUtil$getWrappingClasses$.invoke) 2016-11-23 18:29:23 +01:00
Dmitry Jemerov f9f590d270 More diagnostics for EA-85926 and EA-77163 2016-11-23 18:29:21 +01:00
Dmitry Jemerov d803831548 A facade light class inherits only java.lang.Object (EA-91597 - NPE: KtLightClassForFacade.getClsDelegate) 2016-11-23 18:29:20 +01:00
Nikolay Krasko 1889f4f7b1 Fix breakpoints in function literals in inline calls (KT-11521, KT-12734, KT-12470)
#KT-11521 Fixed
 #KT-12734 Fixed
 #KT-12470 Fixed
2016-11-23 17:29:28 +03:00
Alexey Andreev 23428c9544 JS: fix coroutine test. Fix hanging IDEA tests 2016-11-23 17:01:03 +03:00
Alexey Andreev 40e00a62f5 JS: fix translation of augmented assignment when RHS changes value of LHS 2016-11-23 12:19:03 +03:00
Alexey Andreev dc8e90809c JS: coroutines: fix handling of throw statement inside try/catch block when controller has handleSuspend function 2016-11-23 12:19:02 +03:00
Alexey Andreev e44edf12e0 JS: coroutines: fix inlining of suspend functions 2016-11-23 12:13:54 +03:00
Alexander Udalov 19520bf29c Extract KotlinMetadataFinder interface out of KotlinClassFinder 2016-11-22 18:19:02 +03:00
Alexander Udalov 5f4313223e Use a specific message collector in built-ins serializer
It's going to be needed to be able to report configuration errors when running
built-ins serializer (e.g. no output destination is passed as an argument)
2016-11-22 18:19:01 +03:00
Alexander Udalov fcb094cd90 Introduce DefaultAnalyzerFacade, use it to analyze built-ins 2016-11-22 18:19:01 +03:00
Alexander Udalov 73f872172f Add multi-platform projects as experimental language feature 2016-11-22 18:19:01 +03:00
Alexander Udalov 525e6e53fe Do not report unhelpful diagnostic for unresolved call inside inline function
#KT-14887 Fixed
2016-11-22 18:19:01 +03:00
Alexander Udalov eacf64e4db Report initializer block-related diagnostic on 'init' keyword 2016-11-22 18:19:01 +03:00
Dmitry Petrov fc2a965d2a Fix decompiler tests. 2016-11-22 14:40:02 +03:00
Denis Zharkov 01c21e218a Add special tests for interceptRun support
Basically they're built upon basic coroutine tests, but for each of them
different interceptResume implementation are injected
(currently there are 12 of them).

It might be more simple just to generated additional testData, but I see this
more problematic in a sense of further maintenance

Note that all tests add idempotent 'interceptRun' operators,
which just execute given lambda in the current thread

 #KT-14891 Fixed
2016-11-22 14:33:40 +03:00
Denis Zharkov 5ff71e1330 Support 'interceptResume' operator in JVM backend
#KT-14891 In Progress
2016-11-22 14:33:40 +03:00
Denis Zharkov c2e6f92aa5 Minor. Extract several methods in coroutine codegen 2016-11-22 14:33:40 +03:00
Denis Zharkov caf6634fd3 Minor. Cleanup CoroutineCodegen 2016-11-22 14:33:40 +03:00
Denis Zharkov 5276c3c755 Support 'interceptResume' operator in frontend
#KT-14891 In Progress
2016-11-22 14:33:40 +03:00
Alexey Sedunov e59754e86c Kotlin Facet: Configure facet automatically on Maven project import 2016-11-22 11:54:09 +03:00
Dmitry Petrov e6fcf20cf2 No variance elision in type alias substitution.
Add test with cyclic inheritance via type alias.
2016-11-22 10:04:47 +03:00
Dmitry Petrov 67fe28b8d8 Combine type annotations for arguments of type aliases. 2016-11-22 10:04:47 +03:00
Dmitry Petrov 063bce23d2 Prohibit constructing projected types via type aliases. 2016-11-22 10:04:47 +03:00
Dmitry Petrov bab9cde280 Type alias projections & substitution rules.
1. Substitution variance (sv) is a substitution composition of type alias argument variance (av)
and corresponding expanding type argument variance (ev):
sv =
  | av == ev -> av
  | av == INVARIANT -> ev
  | ev == INVARIANT -> av
  | else -> (variance conflict error; av)

2. Resulting variance (rv) is a type argument composition of sv and type parameter variance (pv):
rv =
  | sv == tv => INVARIANT
  | sv == INVARIANT => INVARIANT
  | tv == INVARIANT => sv
  | else -> (variance conflict error; sv)
2016-11-22 10:04:47 +03:00
Ilya Gorbunov 49756a897e Just refactor tests that require further investigation 2016-11-21 18:20:33 +03:00
Ilya Gorbunov 62fe89b536 Make several tests running on JS backend. 2016-11-21 18:20:33 +03:00
Ilya Gorbunov 0899a0fdda Make some tests JVM only 2016-11-21 18:20:33 +03:00
Ilya Gorbunov 38840bb529 Do not reference java.util in tests that run on JS backend. 2016-11-21 18:20:33 +03:00
Ilya Gorbunov 491ca582b3 Include collection type aliases into mock-runtime as they are used extremely often in tests 2016-11-21 18:20:33 +03:00
Anton Bannykh 2bec54924f Android tests: use directives from tests-common to determine if the test is supposed to pass on JVM (adds support for IGNORE_BACKEND and IGNORE_BACKEND_WItHOUT_CHECK" directives). 2016-11-21 14:06:29 +03:00
Dmitry Petrov d665193c20 Type alias constructors for inner classes in expressions ans supertype lists. 2016-11-21 10:25:51 +03:00
Dmitry Petrov 4c47d77a9f Report error on non-top-level type aliases (unsupported in 1.1).
Get rid of nested type aliases in project.
2016-11-21 10:25:51 +03:00