Commit Graph

73 Commits

Author SHA1 Message Date
Alexander Dudinsky 36dd883768 Update testData of testKt28385 for 202 version 2020-10-14 12:15:07 +03:00
Ilya Chernikov 69d5635aae [minor] Fix textdata after reapplying commit w\ CompilerMessageLocation 2020-06-09 10:34:38 +02:00
Ilya Chernikov 994897cee9 Fix textdata after reverting a commit about CompilerMessageLocation 2020-05-20 10:37:56 +02:00
Alexander Udalov 4597fff18a Prohibit OptionalExpectation on nested annotation classes
Because the new generation scheme based on module metadata does not
support them, and we don't plan to have them in the standard library
yet.
2020-05-12 19:28:58 +02:00
Ilya Muradyan d2fec96f38 Add new REPL API JVM implementation 2020-04-16 21:16:08 +02:00
Mikhail Zarechenskiy 9607739d30 Introduce synthetic scope for constructors of fun interfaces
#KT-37434 Fixed
2020-04-15 02:37:34 +03:00
Mikhail Zarechenskiy d1a8f57740 Disable New Inference in JS backend
See #KT-37163 for details
2020-03-02 18:03:41 +03:00
Mikhail Zarechenskiy 00469712d1 [NI] Don't use only platform specific checks for FIC in inference 2020-01-27 11:03:55 +03:00
Alexander Udalov 7742a3b697 Rename UseExperimental->OptIn, Experimental->RequiresOptIn in compiler tests 2020-01-14 21:04:42 +01:00
Leonid Startsev 1ed4930a2e Fix failing tests after 395d595b 2019-10-11 14:24:51 +03:00
Dmitry Savvinov 3989f351ff Use modules instead of files for MPP diagnostic
Using files turned to be a bad idea, because people often
use the same name for files with expects and with corresponding actuals.

This commits disambiguiates ambiguous message for
AMBIGUOUS_ACTUALS/AMBGIUOUS_EXPECTS diagnostics by using modules instead
of files

^KT-32582 Fixed
2019-10-02 16:52:40 +03:00
Dmitry Savvinov 4694a7963b Allow actuals with more permissive visibility
Allow non-virtual expects to have actuals with more permissive
visibility.

^KT-19664 Fixed
2019-01-31 12:29:27 +03:00
Dmitry Savvinov f174ee863d Don't run ExpectedActualDeclarationChecker on property accessors
One might think that it shouldn't be run because of 'if (declaration
!is KtNamedDeclaration) return' check in the 'check'-overload.

However, for default accessors we pass PSI for property, i.e.
KtProperty (see 'DeclarationCheckers.checkAccessors'), which
obviously passes this check

Note that we can't use `DescriptorToSourceUtils` here, because it's
returns `KtProperty` for default accessor too.

This commits adds specific check for that case, to avoid exception in
KT-28385. Ideal solution would be to either don't launch checkers on
such parameters, or explicitly declare semantic of the
'declaration'-parameter, e.g. to rename it to 'reportOn' (see KT-28403
for discussion)

^KT-28385 Fixed
2018-12-05 11:50:35 +03:00
Dmitry Savvinov 415fcf70e9 Add test on incomplete code in MPP
Currently, the behavior is undesired. See the next commit for the fix

^KT-28385 In Progress
2018-12-05 11:50:35 +03:00
Mikhail Glukhikh cb92009862 Fix maven build + ~50 compiler tests broken by UNUSED_PARAMETER in main 2018-10-26 19:51:20 +03:00
Denis Zharkov 956f8ad5e9 Support deserialized contracts in common code
#KT-26687 Fixed
2018-09-17 12:48:42 +03:00
Ilmir Usmanov 2d04acba42 Update test data of compiler tests, except IR tests 2018-08-30 16:24:41 +03:00
Dmitry Savvinov b064c48f83 Fix testdata after advancing LATEST_STABLE to 1.3
This commit contains minor changes in testdata, where test and behavior
change are not related
2018-08-30 16:24:31 +03:00
Ilmir Usmanov cf1f194f8b Add warning on -Xcoroutines flag use
The only case when warning is not reported is -Xcoroutines=default.
But this is OK until the flag is removed completely.
2018-08-30 14:55:50 +03:00
Alexander Udalov e56374908e Disallow using optional annotations outside common module sources
#KT-25196 Fixed
2018-08-21 12:49:10 +02:00
Alexander Udalov 1951d38f40 Retain optional expected annotations when compiling platform code
After this change, optional expected annotations will be compiled to
physical class files on JVM, and stored to metadata on other platforms,
to allow their usages from dependent platform modules. For example:

    @OptionalExpectation
    expect annotation class A

When compiling this code on JVM, A.class will be produced as if the
class A did neither have the 'expect' modifier, nor had it been
annotated with OptionalExpectation. Note that if there's no actual
annotation class for A, then usages (which can only be usages as
annotation entries) are simply skipped.

Class A will be public from Kotlin's point of view (since it should
be possible to use it in Kotlin sources), but _package-private_ in Java
to disallow its usages outside of the declaring module.

 #KT-18882 Fixed
 #KT-24617 Fixed
2018-06-26 10:23:55 +02:00
Alexander Udalov 9309570752 Fix serialization of type parameters inner generic class
The call to `createTopLevel` instead of `create` (which creates
serializers for outer classes properly, with correct type parameter
contexts) caused MetadataSerializer to write type parameter metadata
incorrectly.  For example, in the following case:

    class A<E> {
        inner class B<T, E> { ... }
    }

A's type parameter E would get id 0, and B's type parameters T and E
would get ids 0 and 1. This is a problem because ids are supposed to be
unique for each class including its outer classes, and deserializer,
decompiler and stub builder rely on this assumption.

JVM metadata is unaffected because `create` is called correctly there,
see MemberCodegen#generateKotlinClassMetadataAnnotation

 #KT-24944 Fixed
2018-06-21 14:45:45 +02:00
Mikhail Zarechenskiy 8148bdc4d0 Support inline classes in MPP resolver/checker model 2018-06-08 19:13:39 +03:00
Alexander Udalov bf3419c3bd Introduce OptionalExpectation for annotations missing on some platforms
This commits adds a new annotation OptionalExpectation to the standard
library, which is experimental. To enable its usage, either pass
'-Xuse-experimental=kotlin.ExperimentalMultiplatform' as a compiler
argument, or '-Xuse-experimental=kotlin.Experimental' and also annotate
each usage with `@UseExperimental(ExperimentalMultiplatform::class)`

 #KT-18882 Fixed
2018-05-24 13:14:51 +02:00
Alexander Udalov 97314d010d Serialize default argument values presence for actual declarations correctly
When default argument value was present in the expected declaration, we
did not correctly serialize that fact to the metadata for the actual
declaration (`declaresDefaultValue` was used). Therefore, it was
impossible to use that actual declaration without passing all parameter
values in another module, where it was seen as a deserialized descriptor

 #KT-21913
2018-02-08 14:11:57 +01:00
Alexander Udalov 22595acbfd Fix AssertionError on overloading function with property in actual class
#KT-22352 Fixed
2018-02-08 14:11:56 +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
Alexander Udalov db4ce703a6 Support default arguments for expected declarations
#KT-21913 Fixed
2018-02-05 13:38:05 +01:00
Alexander Udalov f198a28276 Fix type parameter bound check in expect-actual checker
Also make TypeParameterUpperBounds a "strong" incompatibility, meaning
that non-actual members from platform module are _not_ going to be
matched to the expected members if this incompatibility exists between
them, and therefore NO_ACTUAL_FOR_EXPECT will be reported on the
expected declaration, instead of ACTUAL_MISSING on the platform member.
This is needed because the difference in type parameter upper bounds can
have effect on the function signature on the platform (e.g. on JVM,
Array<T> -> T[], but Array<T> -> Comparable[] if T : Comparable<T>), and
it would be incorrect to report ACTUAL_MISSING on the member that has
nothing to do with the expected declaration that happens to coincide
with it in everything except type parameter bounds

 #KT-21864 Fixed
2018-02-05 13:38:04 +01:00
Alexander Udalov 8c6b140865 Simplify diagnostic message for ACTUAL_MISSING
#KT-21939 Fixed
2018-02-05 13:38:03 +01:00
Kirill Rakhman 8bc020f31b Fix modifier order in generated overriden functions
Fixes #KT-21600
2018-01-16 15:42:02 +01:00
Mikhail Zarechenskiy 61d1963ddb Mark incompatibilities related to the declaration signature as STRONG 2017-10-13 16:14:43 +03:00
Mikhail Zarechenskiy b2dc82f17e Improve diagnostic for non-actual declaration with weak incompatibility 2017-10-13 16:14:17 +03:00
Mikhail Zarechenskiy d0cbd73307 Don't report incompatibility expect/actual errors on usual overloads
Divide incompatibility on two groups: strong and weak. Strong incompatibility means that if declaration with such incompatibility has no `actual` modifier then it's considered as usual overload and we'll not report any error on it.

 #KT-20540 Fixed
 #KT-20680 Fixed
2017-10-13 16:14:14 +03:00
Alexander Udalov ecfea9e340 Forbid private 'expect' declarations
#KT-19170 Fixed
2017-10-11 17:21:55 +02:00
Mikhail Zarechenskiy 88595e1a58 Don't require to override abstract methods in expect class
#KT-16099 Fixed
2017-10-11 15:27:50 +03:00
Mikhail Glukhikh 8a3fed15f8 Report NO_ACTUAL_FOR_EXPECT etc. on relevant declaration
So #KT-20398 Fixed
2017-10-06 10:48:34 +03:00
Mikhail Glukhikh 472e6f462f Report some actual declaration problems on declaration name
Related to KT-20398
2017-10-06 10:48:24 +03:00
Mikhail Zarechenskiy f3344ec2b2 Treat expect classes as not having implicit default constructors
#KT-15522 Fixed
2017-10-05 00:10:42 +03:00
Alexander Udalov 09f36927a5 Do not try to generate 'expect' declarations in multifile classes
Similarly to PackageCodegenImpl#generateFile

 #KT-15754 Fixed
 #KT-17478 Fixed
2017-09-25 11:58:20 +03:00
Mikhail Glukhikh f348ee9381 Fix a pair of multi-platform messages #KT-20327 Fixed 2017-09-25 11:47:05 +03:00
Alexey Andreev a2bfaf4fc8 Fix multiplatform test (use expect/actual instead of header/impl) 2017-09-19 15:21:30 +03:00
Mikhail Glukhikh 721889600f Expect/actual: fix some error messages 2017-09-18 16:09:18 +03:00
Alexey Andreev a66cd8b309 Fix name clash in JS implementation of multiplatform extension property
See KT-18756
2017-09-18 13:10:51 +03:00
Mikhail Glukhikh a18e9436a1 Migration to expect/actual: change diagnostics rendering 2017-09-16 19:47:40 +03:00
Stanislav Erokhin 7982f3489e Rename compiler key -Xno-check-impl to -Xno-check-actual 2017-09-16 19:47:39 +03:00
Mikhail Glukhikh 85d6a4d1af Migration to expect/actual: fix multiplatform integration tests 2017-09-15 18:28:50 +03:00
Alexander Udalov 05290c3ed2 Fix AssertionError on incompatible scopes with impl typealias
This has been introduced in 9ecd04f628
2017-09-01 14:47:29 +03:00
Alexander Udalov b87abc9f0f Relax rules related to noinline/crossinline/reified in header/impl functions
See the comments in KT-18752 for the current resolution

 #KT-15377 Fixed
 #KT-18752 Fixed
2017-08-25 15:40:38 +03:00
Alexander Udalov d1cff41ce0 Treat nested class of header class as header
Note that the quick fix to implement header class works incorrectly when
that class has nested classes at the moment; this should be fixed
separately

 #KT-15494 Fixed
 #KT-18573 Fixed
2017-08-25 15:40:37 +03:00