Commit Graph

1472 Commits

Author SHA1 Message Date
Alexander Udalov 0593b833b5 Check extension receiver properly for property references
Without this, the unrelated type specified on the LHS of a property reference
literal was considered to be an extension receiver of the candidate, and the
resolution was erroneously successul. This is only reproducible for properties,
because if we're trying to resolve an extension, we consider all properties
from the scope, even non-extensions, because there may be a property of an
extension-functional type (T.() -> R). (We don't do this for functions.)

 #KT-7430 Fixed
 #KT-7945 Fixed
2015-06-23 23:35:17 +03:00
Denis Zharkov 602a1c11ac Fix testData: parameter names are dropped from annotations 2015-06-23 16:44:47 +03:00
Pavel V. Talanov 997a6f1381 Fix import resolution for some cases of malformed imports ("import some.")
Fix parsing import directives in case of non-identifier after "import"
Add diagnostics test for malformed imports
2015-06-23 15:19:14 +03:00
Mikhail Glukhikh 065db07e1c More accurate check on an enum entry deprecated super constructor #EA-69735 Fixed 2015-06-19 13:50:49 +03:00
dnpetrov 046189087a KT-5963 Call to super shouldn't require type specification if there is no conflict
Implemented unqualified 'super' type resolution (in BasicExpressionTypingVisitor).

No overload resolution of any kind is involved.
Corresponding supertype is determined by the expected member name only:
- 'super.foo(...)' - function or property (of possibly callable type) 'foo'
- 'super.x' - property 'x'
Supertype should provide a non-abstract implementation of such member.
As a fall-back solution for diagnostics purposes, consider supertypes with abstract implementation of such member.

Diagnostics:
- AMBIGUOUS_SUPER on 'super', if multiple possible supertypes are available;
- ABSTRACT_SUPER_CALL on selector expression, if the only available implementation is abstract.

#KT-5963 Fixed
2015-06-18 14:16:34 +03:00
Alexander Udalov 1a3209e1dc Drop traits with required classes
#KT-4771 Rejected
2015-06-17 16:23:58 +03:00
Alexander Udalov 4dcc373a5a Fix concrete method inheritance in interfaces
For each non-abstract non-declared (i.e. inherited from supertypes) method in
an interface we generate its static form to the TImpl, which calls the TImpl
method from the corresponding supertype.

The accidental override tests changed because we're now trying to generate the
delegate for the super method, not knowing that it will clash with the declared
method

 #KT-2888 Fixed
 #KT-5393 Fixed
2015-06-17 16:23:56 +03:00
Mikhail Glukhikh 707307b19c Fix for a cyclic generic upper bound for a class type parameter. A pair of tests. 2015-06-17 11:56:28 +03:00
Alexey Sedunov f08c7d0fd8 Call Resolver: Fix nullability of parenthesized safe calls used as value arguments
#KT-7903 Fixed
2015-06-16 21:15:29 +03:00
Valentin Kipyatkov c8f9b466b6 More correct comparison with CANT_INFER_FUNCTION_PARAM_TYPE 2015-06-15 18:32:44 +03:00
Alexander Udalov 3a6ba67602 Delete unused diagnostic about j.l.Class in annotations 2015-06-15 15:55:23 +03:00
Mikhail Glukhikh e623aadf00 Exception fix: more accurate parsing of class base type #EA-65509 Fixed 2015-06-15 14:43:37 +03:00
Mikhail Glukhikh d77c6eb30e Exception fix: diagnose an error for a generic type which is a subtype of itself, a set of tests #EA-64453 Fixed 2015-06-15 14:43:24 +03:00
Mikhail Glukhikh 46d5290f70 Exception fix (equal returns true for the same types) #EA-65206 Fixed 2015-06-15 14:43:17 +03:00
Denis Zharkov da254ab1a0 Drop support of java.lang.Class as annotation parameter
Also drop some related diagnostics and testData
2015-06-12 09:55:12 +03:00
Denis Zharkov d71fe0d11a Drop JavaClassValue and it's usages
Also drop related testData
2015-06-12 09:55:10 +03:00
Denis Zharkov 2e284718ce Revert "Create additional constructor for java annotation with Class-parameter"
This reverts commit 8f0e290dec.
2015-06-12 09:55:06 +03:00
Denis Zharkov 9080b57635 Revert "Load annotation parameter's type for ctr as contravariant"
This reverts commit 294eb1dceb.
2015-06-12 09:55:03 +03:00
Denis Zharkov 2df6fcb785 Drop some tests using java.lang.Class in annotation
We are going to drop such cases anyway, but they're annoying when reverting commits
2015-06-12 09:55:02 +03:00
Denis Zharkov 26864a4407 Get rid of annotation syntax deprecation related things 2015-06-12 09:23:32 +03:00
Denis Zharkov c9f79c2d05 Adjust testData: get rid of obsolete annotations 2015-06-12 09:23:31 +03:00
Alexey Sedunov e1e1dd9413 Diagnostics: Fix range of DECLARATION_SIGNATURE diagnostics reported on secondary constructors 2015-06-11 13:53:00 +03:00
Alexey Sedunov 1ea2c24562 Light Classes: Primary constructor fixes 2015-06-11 13:52:48 +03:00
Mikhail Glukhikh f9fe8cd341 Fixed annotation resolve for loop parameter or catched exceptions type 2015-06-10 18:38:27 +03:00
Mikhail Glukhikh 731e5d85a4 Annotation arguments resolve refactoring via ForceResolveUtil. Deptecated...Intention fixed accordingly 2015-06-10 18:38:25 +03:00
Alexander Udalov 64b60718e3 Finish off old deprecated function/extension function classes
This reverts commit d14e5b8a72.
2015-06-10 14:41:57 +03:00
Mikhail Glukhikh a792b29a78 Exception fix: more accurate type annotation parsing #EA-69124 Fixed 2015-06-09 14:36:12 +03:00
Pavel V. Talanov 7585cbfe22 Remove check in visibilities that allowed access to privates of outer packages
It doesn't work for a while now in imports and is planned to be dropped with upcoming changes to private
2015-06-08 20:25:52 +03:00
Alexander Udalov 6e97f85863 Fix type argument substitution bug in KFunction construction
For example,

KMemberFunction2<T, P1, P2, R> : KMemberFunction<T, R>

So for this inheritance the heuristic that was present ("take the last K type
parameters of the subclass, and substitute for K parameters of the superclass")
was wrong. The new heuristic for this case is: take type parameters with the
same names.

Also don't store "parameters" in a lazy value, since it's easy to compute and
it's computed practically every time anyway
2015-06-04 23:08:21 +03:00
Mikhail Glukhikh 98407a7c4b Recursive annotations are now possible for properties / functions / classes / primary constructors #EA-66984 Fixed #EA-63992 Fixed #EA-64272 Fixed
A set of tests provided.
2015-06-04 20:09:36 +03:00
dnpetrov 50ea67ba13 KT-5524 Support [platformName] annotation for class members
@platformName is now supported for final non-overriding class member functions
(including property accessors).
Front-end provides diagnostics for inapplicable annotation cases.
Code generation updated:
- ignore kotlin.platform.platformName annotation for Java class methods;
- bridges generation generates proper JVM declarations in case of methods renamed with @platformName.
@platformName-related tests added.

#KT-5524 Fixed
2015-06-04 17:54:08 +03:00
Denis Zharkov 8da3f53404 EA-53937: Drop failing assertion about no-name val in annotation 2015-06-04 16:11:02 +03:00
Pavel V. Talanov ccaa779e2f Minor: fix test 2015-06-02 19:06:27 +03:00
Alexander Udalov 158b3ba102 Make parameter names of fictitious function classes non-stable
To be able to change them when overriding invoke in subclasses without a
warning
2015-06-02 17:30:58 +03:00
Pavel V. Talanov d2592e4a2c Companion objects have public visibility by default
#KT-7114 Fixed
2015-06-02 16:23:03 +03:00
Valentin Kipyatkov aefe0dd192 Changed highlighting range and attributes of useless elvis operator 2015-06-02 14:35:19 +03:00
Denis Zharkov 349d5f02ea Drop wrong assertion about duplicating properties in data class
#EA-64269 Fixed
2015-06-02 14:07:49 +03:00
Denis Zharkov 70dbbd8fda Resolve constructors declared in traits and objects
It prevents exceptions and produces less red code

 #EA-68667 Fixed
2015-06-02 14:07:49 +03:00
Denis Zharkov 7f9d2e8a36 Refine diagnostics reported on primary constructors 2015-06-02 14:07:49 +03:00
Alexander Udalov d2508c8710 Do not report irrelevant diagnostics on unresolved supertypes
Previously the confusing "trait with superclass" was reported when an
unresolved classifier appeared in interface supertypes
2015-06-02 12:30:14 +03:00
Mikhail Glukhikh dea2ec9da6 When now tries to smart cast subject to not-null if contains no null case #KT-7857 Fixed
Some new tests + some fixed tests
2015-06-02 10:56:21 +03:00
Mikhail Glukhikh de12771c0f Warning generation on non-exhaustive whens over enums + a set of tests + fixed test #KT-6227 Fixed 2015-06-02 10:56:17 +03:00
Mikhail Glukhikh 969993bd09 Fix for EA-68871 #EA-68871 Fixed 2015-06-02 10:56:13 +03:00
Alexander Udalov 12a6461006 Report 'free function called as extension' on Function subclasses
You can't make a value of some type invokable as an extension by adding
'extension' annotation to the type
2015-06-01 19:23:10 +03:00
Zalim Bashorov 72c2648fc8 JS frontend: remove diagnostics about the secondary constructors are not supported 2015-05-28 10:24:47 +03:00
Alexander Udalov d14e5b8a72 Restore and deprecate Function{n}/ExtensionFunction{n} classes for easier migration
Users' Java code will not break in common cases (when passing functions to
Kotlin), and deprecation warnings will be reported.

Provide an inspection with a quick fix which allows to replace deprecated
function class usages to the new classes. Include this fix to the "code
cleanup" action
2015-05-28 01:20:05 +03:00
Mikhail Glukhikh 3ad06f169d Solution for EA-66870: Foo<in *> and Foo<out *> types are now treated as incorrect.
#EA-66870  Fixed.
2015-05-27 19:07:46 +03:00
Mikhail Glukhikh 4fb331ecd3 Solution for KT-7838: now data flow information at the end of when expression is determined correctly.
#KT-7838  Fixed.
2015-05-27 19:07:41 +03:00
Dmitry Jemerov 1188e57597 rename @overloads annotation to @jvmOverloads 2015-05-27 12:23:08 +02:00
Alexander Udalov 6ae7ed1cc4 Add some new tests on functions and extension functions 2015-05-27 01:44:19 +03:00