Commit Graph

259 Commits

Author SHA1 Message Date
Mikhail Likholetov 80cd26c9df [FIR] Support several annotation class diagnostics 2020-05-21 18:01:36 +03:00
Likholetov Mikhail aa706d322d [FIR] Support several annotation class diagnostics 2020-05-06 10:32:01 +03:00
Mikhail Glukhikh 036b6c63f6 [FIR] During resolve, set correctly property reference type in delegate 2020-04-03 13:18:47 +03:00
FenstonSingel b7d8e879a6 [FIR] Support 4 diagnostics for pairs of modifiers
In particular, this commit includes:
* Attempt to abstract access to FirSourceElement via FirModifier
* Add more visit functions to DeclarationCheckersDiagnosticComponent
* Add messages+factories for 4 modifier-related errors and warnings
* Introduce FirModifierChecker
2020-03-27 12:34:29 +03:00
Ilya Chernikov 70c89a28e1 Stop subtyping constraint search if equality constraints for...
all not fixed type vars are found
#KT-35626 fixed
2020-03-12 08:02:45 +01:00
Mikhail Glukhikh 5af4efd5a7 Remove FIR test data file accidentally left in 8884cbe4 2020-03-05 15:51:41 +03:00
Mikhail Glukhikh 8884cbe415 Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed 2020-03-05 09:39:40 +03:00
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00
Mikhail Glukhikh 64c7ab1302 [FIR] Fix lambda resolve in independent context 2020-02-04 15:00:12 +03:00
Victor Petukhov 5c6e710013 Revert "Workaround an inliner problem upon which the compiler code itself stumbled ^KT-35856 Fixed"
This reverts commit 59175912
2020-01-24 16:41:22 +03:00
Victor Petukhov 5917591205 Workaround an inliner problem upon which the compiler code itself stumbled
^KT-35856 Fixed
2020-01-10 12:13:46 +03:00
Mikhail Zarechenskiy 8871c8b4fd Migrate diagnostic tests to 1.4 2019-12-26 15:08:51 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
Pavel Kirpichenkov 8c52bb4212 Add frontend checks for missing dependency supertypes
Call checker and declaration checker are used in order to preserve backward compatibility.
Attempt to use classifier usage checker was not good enouth,
since not all errors found with it would actually be reported before.
For example types and constructor calls don't cause supertypes to resolve,
so missing supertypes would not lead to errors in case they are the only use of class name.

Updated tests failing due to missing Java dependencies in superclasses.
2019-11-18 12:06:41 +03:00
Pavel Kirpichenkov 87b88a738e [Minor] Update test data for NI 2019-10-25 19:37:06 +03:00
Pavel Kirpichenkov b7e5d9faae Update annotation rendering in diagnostics
Disable annotation rendering in default type and descriptor renderers.
Preserve annotations in Android and Serialization plugins.
Update error texts in ide tests.
Nullability annotations in Java descriptors are rendered with context-dependent renderer.

#KT-20258 Fixed
2019-10-04 11:18:45 +03:00
victor.petukhov 6a679d86ab Support non-parenthesized annotations on functional types without receiver
^KT-31734 Fixed
2019-07-17 16:18:15 +03:00
Mikhail Zarechenskiy bcc8802014 [NI] Avoid constraints from expected type for effectively empty system
Expression will be checked against expected type later.

 Theoretically, this is not very good, but it aligns with the old
 inference, plus it helps avoiding multiple type mismatch diagnostics.
2019-04-17 12:55:12 +03:00
Dmitriy Novozhilov 677987c85f Add diagnostics on annotations on super types. KT-23992 fixed 2019-02-22 10:28:21 +03:00
Dmitriy Novozhilov 1fc6f30c50 Add test for KT-23992 2019-02-22 10:22:19 +03:00
Dmitriy Novozhilov 92bd907983 Fix checking repeatablilty of use-site target annotations. KT-26638 fixed 2019-02-22 10:15:37 +03:00
Dmitriy Novozhilov cfda468f13 Add test for KT-26638 2019-02-22 10:15:37 +03:00
Alexander Udalov 4692247897 Do not check backing field presence in AnnotationSplitter
This code can be invoked early, during body resolution and before the
fact that a property has backing field (which is only known for certain
after body resolution, because an implicit 'field' identifier may be
used). Since split annotations are cached until the end of the program,
they may end up on incorrect elements in the bytecode (or disappear
completely) as in KT-29507 or KT-28182.

Because the FIELD target has the lowest priority among implicit
annotation targets (see TARGET_PRIORITIES), it's safe to always assume
that FIELD is a valid target when splitting annotations. This only
changes the way annotations are split in case of incorrect code, as
changes in test data show.

 #KT-28182 Fixed
 #KT-29507 Fixed
2019-02-15 17:53:27 +01:00
victor.petukhov 46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00
Ilya Chernikov 2c02ee3d29 Rename test files to scripts to trigger proper scripting initialization
fix generation config accordingly
2019-02-10 13:31:57 +01:00
Mikhail Zarechenskiy 958aeff94b Prohibit type parameters for local variables in LV >= 1.4 & -progressive
#KT-8341 Fixed
2018-12-24 12:47:58 +03:00
Mikhail Glukhikh f3555daa60 Report UNUSED_PARAMETER on main parameter in 1.3+ #KT-26999 Fixed 2018-10-25 19:10:39 +03:00
Alexander Udalov d1e1e274d9 Render property accessor annotations in .txt test data
If property accessor rendering is disabled in a test, render annotations
on accessors as use-site-targeted, as was done with
`@setparam:`-annotations. Otherwise they were lost
2018-10-24 18:17:12 +02:00
Alexander Udalov f9b9b6908a Remove use-site targeted annotations from LazyAnnotations
LazyAnnotations are only used for classes and files, and in the latter
case it will now contain file annotations as normal annotations, without
the target "file:"
2018-09-06 19:13:15 +03:00
Alexander Udalov 87c0d56618 Drop Annotations.getAllAnnotations 2018-09-06 19:13:14 +03:00
Alexander Udalov fc87043cb3 Merge use-site targeted annotations into corresponding Annotations
Add PropertyDescriptor.backingField/delegateField to store annotations
on the field directly in an otherwise almost empty descriptor instance,
instead of storing them with use-sites in the corresponding property
descriptor. Instead of AnnotationWithTarget, create AnnotationDescriptor
instances in AnnotationSplitter. Change DescriptorRenderer to render
annotations on "related" declarations when needed, with the explicit
use-site target if applicable.

Most changes in diagnostic test data are related to the fact that
annotations which are known to have an incompatible use-site to the
declaration they're applied at (such as `@param:`-annotation on a
function), are now not loaded at all. It's fine because the code is
erroneous, so it doesn't really matter how do we load annotations with
invalid targets (some of this logic is also changed freely in subsequent
commits). Some changes are also explained by the fact that for example
an annotation on the property which is only applicable to FIELD is now
rendered with an explicit use-site target `@field:`, regardless of
whether it did have that use-site target syntactically or not.

Basically, after this change there's no point in calling
Annotations.getUseSiteTargetedAnnotations/getAllAnnotations anymore
because it's easier and more intuitive to just use Annotations of the
corresponding descriptor -- the backing / delegate field (introduced in
this commit) or the extension receiver / setter parameter (related
behavior was fixed in previous commits). Usages of
use-site-target-related methods will be refactored out in subsequent
commits
2018-09-06 19:13:11 +03:00
Dmitry Petrov 5767f84c0e Restrict retention for annotations with target EXPRESSION
#KT-13762 Fixed
2018-07-18 14:21:03 +03:00
Mikhail Zarechenskiy de60c9b635 Fix language features in tests for gradual migration to 1.3 version 2018-07-02 12:13:11 +03:00
Stanislav Erokhin 18b65e7bcf [NI] Update test data 2018-06-04 12:21:47 +03:00
Mikhail Glukhikh e76debb12b Report UNUSED_PARAMETER in setter #KT-21129 Fixed 2018-05-04 18:04:57 +03:00
Mikhail Zarechenskiy effdfe8ec0 Prohibit incorrect annotations with use-site targets more precisely
#KT-21696 Fixed

The problem is coming from the fact that `AnnotationTarget.VALUE_PARAMETER` is mapped to receiver parameter and to value parameter, but annotation with use-site target `receiver` can be used only on type reference of receiver parameter
2018-03-22 04:03:08 +03:00
Mikhail Zarechenskiy 4ebd11a7ae Refactoring: rename parameter to argument for annotation diagnostics 2018-03-22 03:59:55 +03:00
Alexander Udalov e2def0c60e Do not report "invalid type of annotation member" on error types
In case the referred type is actually an enum that is not found in
dependencies due to a configuration problem, this usage could be valid.
So we can avoid reporting an error here, to reduce the number of
diagnostics.

Also do not report "default value of annotation parameter must be a
compile-time constant" in the same case for the same reason
2018-01-29 12:20:36 +01:00
Alexander Udalov a46a2b9b1c Support nested classes in annotation classes
#KT-16962 In Progress
2018-01-24 15:54:35 +01:00
Dmitry Savvinov ea72c76a37 [NI] Testdata changes after fixes in error types 2017-12-07 12:49:56 +03:00
Mikhail Zarechenskiy 8757298994 Add diagnostics to test data from NI 2017-11-29 02:54:26 +03:00
Mikhail Zarechenskiy a71238bf94 Place !WITH_NEW_INFERENCE directive to diagnostics test data 2017-11-29 02:53:49 +03:00
Alexander Udalov 56a51c1d22 Do not treat annotation classes as interfaces in bridges codegen
From Kotlin's point of view, everything in annotation classes is
non-abstract. A class inheriting from an annotation has a non-abstract
fake override for each property of the annotation class constructor. But
because members of annotation classes themselves were considered as
abstract in the bridge-generating code (see
DescriptorBasedFunctionHandle.isAbstract), there was a situation where a
concrete fake override has only one declaration among overridden
descriptors and it was abstract. This situation is invalid (a concrete
fake override must have exactly one concrete super-declaration),
therefore an exception was thrown.

The fix is to avoid considering annotation class members abstract for
the purposes of bridge generation. It's reasonably safe because no
bridges should be ever generated for annotation subclasses anyway,
because annotations can only have members with simple return types
(final and non-generic).

Note that in KT-19928, the problem is reproducible because of an
incorrect "inexact analysis" in light classes where "Target" is resolved
to an annotation class kotlin.annotation.Target. This behavior of the
analysis in light classes seems to do no harm otherwise, so it's not a
goal of this commit to change anything in that regard

 #KT-19928 Fixed
2017-11-02 14:02:09 +01:00
Alexander Udalov 6f2e6db131 Check the RequireKotlin annotation value
Similarly to SinceKotlin
2017-10-10 13:21:50 +02:00
Mikhail Zarechenskiy e16d16fdb7 Do not report diagnostic about annotation with receiver target twice 2017-09-12 17:39:24 +03:00
Mikhail Zarechenskiy 2048a74302 Introduce Language Feature for annotations with wrong targets
#KT-9580 Fixed
2017-09-12 17:39:23 +03:00
Mikhail Zarechenskiy a4766cc293 Report errors on annotations with wrong use site targets
#KT-9580 In Progress
2017-09-12 17:39:22 +03:00
baratynskiy 67fdd9f76e javac-wrapper: fixes after rebase and review 2017-08-29 18:01:36 +03:00
baratynskiy 01883a41cb javac-wrapper: refactoring, fixes and tests 2017-08-29 18:01:36 +03:00
Alexander Udalov 770441c212 Merge "diagnostic with Java 8" tests with general diagnostic tests 2017-08-17 13:15:18 +03:00