Commit Graph

47 Commits

Author SHA1 Message Date
victor.petukhov
46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +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
0338753c11 Add test on actual with more permissive visibility
Currently the behaviour is undesired, see KT-19664. The next commit
fixes it.
2019-01-31 12:26:58 +03:00
Mikhail Glukhikh
1d2438e04e Report SUPERTYPE_NOT_INITIALIZED even if no constructors in superclass
Before this commit, expect super-class without constructors did not
provoke SUPERTYPE_NOT_INITIALIZED. However, it should, but only
if sub-type is normal class (not an expect one).

So #KT-24597 Fixed
2018-08-06 19:02:24 +03:00
Mikhail Glukhikh
e76debb12b Report UNUSED_PARAMETER in setter #KT-21129 Fixed 2018-05-04 18:04:57 +03:00
Alexander Udalov
60a551404a Refine modality of fake overrides inherited from abstract expected members
In an open expected class inheriting an expected interface, abstract
members are now inherited as _open_ fake overrides, not final. Final was
technically safer but also stricter and thus could be unexpected by the
user. In a final class, abstract members are still inherited as _final_
fake overrides. So, the general rule is now the following: the modality
of an expected fake override, which overrides only abstract members, in
a non-abstract class is equal to the modality of that class

 #KT-22031 Fixed
2018-02-14 12:45:45 +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
56be83cdd3 Improve fake override construction for expected classes
Fake overrides for abstract members from expected classes should become
non-abstract (final, in fact) in non-abstract expected subclasses

 #KT-22031 Fixed
2018-02-08 14:11:55 +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
f75b774d80 Do not report unused parameters for actual constructors
Extract common part for functions and constructors in
processUnusedParameter
2018-02-05 13:38:04 +01:00
Alexander Udalov
1bdec829ea Treat constructors as actual only if the 'actual' modifier is present
Exactly as this is done for functions in
FunctionDescriptorResolver.initializeFunctionDescriptorAndExplicitReturnType

 #KT-21906 Fixed
2018-02-05 13:38:04 +01:00
Kirill Rakhman
8bc020f31b Fix modifier order in generated overriden functions
Fixes #KT-21600
2018-01-16 15:42:02 +01:00
Alexander Udalov
8a0dcca957 Do not consider 'expect' class type constructors final
Because even a final expected class can be actualized with an open
actual class and thus have subtypes in the platform code
2017-10-16 15:08:50 +02:00
Alexander Udalov
2682837fd7 Support 'expect final' -> 'actual open' for callables
#KT-17944
2017-10-16 15:08:50 +02:00
Mikhail Zarechenskiy
61d1963ddb Mark incompatibilities related to the declaration signature as STRONG 2017-10-13 16:14:43 +03:00
Mikhail Zarechenskiy
d557c19a88 Test for consistent modality check with implicit and explicit override
Test for KT-20680
2017-10-13 16:14:40 +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
Mikhail Zarechenskiy
eb828e3497 Report errors about incompatible constructors of actual class
#KT-20540 In Progress
 #KT-20680 In Progress
2017-10-13 16:13:40 +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 Zarechenskiy
5695e76a00 Prohibit inheritance by delegation in expect classes
#KT-20431 Fixed
2017-10-11 15:27:46 +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
Mikhail Zarechenskiy
32531b3afc Allow to have all parameters with default values in actual annotation
#KT-19656 In Progress
2017-09-25 16:19:05 +03:00
Alexander Udalov
2d9f07deec Minor, add test for obsolete issue on "actual missing" error
#KT-20142
2017-09-25 11:58:20 +03:00
Alexander Udalov
2281ac842a Prohibit super constructor call for 'expect' class
#KT-15490 Fixed
2017-09-25 11:58:20 +03:00
Alexander Udalov
8ae7343557 Prohibit 'expect' lateinit member properties
#KT-20319 Fixed
2017-09-25 11:58:20 +03:00
Alexander Udalov
1f992ed845 Improve error on 'expect' delegated property
#KT-15054 Fixed
 #KT-15055 Fixed
2017-09-25 11:58:20 +03:00
Stanislav Erokhin
2b186909d4 Migrate diagnostic names for header/impl 2017-09-15 18:29:29 +03:00
Mikhail Glukhikh
dd8bed8b46 Migration: expect/actual in diagnostic tests 2017-09-15 18:28:07 +03:00
Alexander Udalov
ac1c7d9a6a Drop Incompatible.NoImpl, fix no "missing impl" on nested class
Header/impl declarations are now considered fully compatible even in the
case when the impl declaration has no "impl" modifier. The error about
no "impl" is now reported separately and only on the impl declaration,
never on the header declaration

 #KT-20087 Fixed
2017-09-12 14:41:11 +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
Alexander Udalov
3a2d93f73e Do not report "header with no impl" on incorrect header
Descriptor for a 'header' member in a non-'header' class now has
isHeader = false

 #KT-18442 Fixed
2017-08-25 15:40:36 +03:00
Alexander Udalov
3bc8ca5913 Report "declaration should be marked with impl" when possible
Also support a quick fix to add 'impl' modifier (KT-18454), although it
doesn't work yet on classes because there's no error on them in the IDE

 #KT-18087 Fixed
 #KT-18452 Fixed
 #KT-18454
2017-08-25 15:35:05 +03:00
Alexander Udalov
9ecd04f628 Improve diagnostics on header/impl classes when scopes don't match
Try to report most of the errors on the actual members of the impl
class. In many cases, there's a 1:1 mapping of header to impl class
members, so the error "some members are not implemented" on the class
declaration itself is redundant. Exceptions include functions/properties
from supertypes (there may be no other place to report a signature
mismatch error in this case), functions/properties not marked with
'impl' (the checker is only run for declarations explicitly marked with
'impl') and default constructors (the checker is not run for them)

 #KT-18447 Fixed
2017-08-25 15:35:05 +03:00
Alexander Udalov
74ba0080b1 Improve header/impl mismatch diagnostic messages
Try to report most mismatch errors on the 'impl' declaration. Only
report a mismatch error on the 'header' declaration if no error would be
otherwise reported on any 'impl' declaration in the compilation unit.
Also render declaration kind in the message

 #KT-18447 In Progress
2017-08-25 15:35:05 +03:00
Alexander Udalov
21f79cd737 Fix test data 2016-12-26 17:11:32 +03:00
Alexander Udalov
e4e50017d0 Render header/impl on properties in tests and diagnostic messages
As a side effect, header/impl and some other modifiers on functions are now
rendered in a different, more natural, order
2016-12-26 17:06:24 +03:00
Alexander Udalov
5556c59fc9 Render platform name in multiplatform diagnostic tests
Prepend the platform name to the diagnostic in a common module, which is
reported when sources of that common module are analyzed as a part of the
platform source set: "<!JVM:...!> ... <!>". Fix some existing tests, mostly by
adding "impl" to implementations
2016-12-26 17:06:15 +03:00
Alexander Udalov
e4d85ac527 Support header annotation classes in common modules
Properties are only allowed to be declared in a header class' primary
constructor if that class is an annotation class. However, we did not correctly
determine that such properties are also "header". The test passed because the
diagnostic was lost
2016-12-26 17:01:24 +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
0634782e47 Allow open impl class for final header class 2016-12-19 11:50:49 +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