Commit Graph

79 Commits

Author SHA1 Message Date
Dmitriy Novozhilov b44dc55109 [TD] Mute some javac tests or update their testdata
There was a refactoring of AbstractDiagnosticsTest in 9052ef06 which
  contains bug that `setupEnvironment` for AbstractDiagnosticsTestUsingJavac
  was not called, so for last year tests `UsingJavac` had no difference
  with usual diagnostics tests which causes some contradictions in test data
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov 721b9b4d8c [FIR] Resolve annotations as calls 2020-08-04 08:59:14 +03:00
Mikhail Zarechenskiy 678b76cab1 Fix presence of Deprecated hidden annotation for reference arguments
#KT-40234 Fixed
2020-07-13 11:23:28 +03:00
Mikhail Zarechenskiy a2da00eb49 Prohibit using DeprecatedSinceKotlin outside kotlin subpackage 2020-06-29 14:25:08 +03:00
Mikhail Zarechenskiy 790433984b Prohibit using DeprecatedSinceKotlin annotation without arguments 2020-06-29 14:25:08 +03:00
Mikhail Zarechenskiy 67100d5ebe Reject values of DeprecatedSince.. that are not parseable as a version 2020-06-29 14:25:07 +03:00
Mikhail Zarechenskiy 5d88058928 Place DeprecatedSinceKotlin annotation under 1.4 version 2020-06-29 14:25:06 +03:00
Mikhail Zarechenskiy 2f55a3fa0d Add various test for DeprecatedSinceKotlin annotation 2020-06-29 14:23:26 +03:00
Mikhail Zarechenskiy 158013ef3a Remove message and replaceWith parameters from DeprecatedSinceKotlin 2020-06-29 14:22:33 +03:00
Mikhail Zarechenskiy 60c51476f2 Introduce declaration checker for DeprecatedSinceKotlin annotation
- DeprecatedSinceKotlin annotation should only be applicable when
   there's `@Deprecated` annotation on the same declaration
 - Deprecation level shouldn't be specified in the relevant
   `@Deprecated` annotation
 - Check that warningSince <= errorSince <= hiddenSince
2020-06-29 14:22:32 +03:00
Alexander Udalov 0aaf29c045 Introduce DeprecatedSinceKotlin annotation
This annotation will be used in the standard library to prevent the new
compiler from reporting deprecation diagnostics in case an older API
version is used (where the declaration was not deprecated yet).

 #KT-23575 Fixed
2020-06-29 14:22:29 +03:00
Yan Zhulanow ef698a5747 Fix "PSI/index mismatch" in case of @ParameterName on non-functional types (KT-34524) 2020-05-27 02:38:41 +09:00
Mikhail Glukhikh 8884cbe415 Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed 2020-03-05 09:39:40 +03:00
Mikhail Glukhikh 2bb5740f47 [FIR] Resolve ambiguities in Java static scopes 2020-01-30 16:28:08 +03:00
Mikhail Glukhikh 14204a842a Refactoring & clarification: implement new FIR tower resolver 2020-01-27 00:34:16 +03:00
Mikhail Glukhikh 69ecbd93a9 [FIR] Fix type alias handling in qualifier position 2020-01-23 12:32:39 +03:00
Mikhail Glukhikh de50f8aef3 FIR resolve: add partial support of extension lambda calls
Here we introduce ONLY_IMPLICIT_RECEIVER tower level
to support extension lambda calls on local variables,
and soften extension receiver checks to make such extensions visible & applicable.
Also here we try to map arguments twice for functional types
2019-12-27 09:57:36 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
Denis Zharkov abad408d7b Do not implicitly propagate deprecations originated in Java
^KT-29604 Fixed
2019-02-13 16:21:05 +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 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
Mikhail Glukhikh e76debb12b Report UNUSED_PARAMETER in setter #KT-21129 Fixed 2018-05-04 18:04:57 +03:00
Alexander Udalov 46b8deedf7 Run classifier usage checkers on constructor calls
In some cases, REFERENCE_TARGET for annotation entries is the annotation
class descriptor, and in others -- the constructor of that class
2018-01-29 12:22:41 +01:00
Dmitry Petrov 674d30cd76 Report deprecation on typealias companion object for deprecated alias 2017-08-10 15:45:44 +03:00
Dmitry Petrov 0391c24ab2 Provide diagnostic for typealias using deprecated class or constructor
#KT-19205 Fixed Target versions 1.1.5
2017-07-26 09:02:45 +03:00
Dmitry Petrov c1ef0bfcdb Report deprecation on usage of type alias expanded to a deprecated class
#KT-15243 Fixed
2017-05-18 10:56:02 +03:00
Dmitry Petrov a2db4dc0d5 Fix incremental compilation problems related to type alias constructors
1. Determine source element for descriptors with NO_SOURCE recursively.

2. Always provide type abbreviation for type alias constructor
return type.

 #KT-15495 Fixed
2017-05-18 10:55:16 +03:00
Dmitry Jemerov 675305fef3 Don't highlight 'this' references as deprecated
#KT-17613 Fixed
2017-05-15 14:57:52 +02:00
Alexander Udalov 57f2feb6fb Fix unreported deprecation on variables called as functions
#KT-16272 Fixed
2017-02-13 14:09:53 +03:00
Mikhail Zarechenskiy 655cf82534 Copy compileTimeInitializer for const property descriptor
#KT-15802 Fixed
2017-02-07 14:07:06 +03:00
Alexander Udalov 212240a008 Collect all deprecations, do not stop on the first found one
#KT-15245 In Progress
2016-12-15 11:46:17 +03:00
Dmitry Petrov 8d634f6003 KT-14274: resolve type alias constructors calls in supertypes list as type alias constructors.
Support @Deprecated for type aliases, including type alias constructors.
2016-10-13 17:52:21 +03:00
Valentin Kipyatkov 968a6cfd04 DescriptorRenderer to skip @ExtensionFunctionType and @ParameterName only when it's redundant 2016-10-11 23:38:54 +03:00
Valentin Kipyatkov ec51076355 DescriptorRenderer to render annotations for all types + separate option to render annotation arguments + use it in IdeDescriptorRenderers 2016-10-11 23:38:54 +03:00
Alexander Udalov aaeae8b948 Support deprecation level HIDDEN for classifiers
Classifiers annotated with `@Deprecated(level = HIDDEN)` now have smaller
priority in imports, similarly to private classes. For example, if two
classifiers named Foo are imported with a star import and one of them is
deprecated-hidden, the name Foo in the source code is resolved to the other
one.

Also a minor change in multi-module diagnostic tests: do not append newlines
after the last module in the test

 #KT-13926 Fixed
2016-10-11 17:30:14 +03:00
Alexander Udalov 83c86d06ed Report error instead of warning for deprecation level HIDDEN
Since functions usually are hidden from resolution when they are
deprecated-hidden, the problem can only be reproduced for properties with
deprecated-hidden accessors, where DeprecatedCallChecker reported warnings
instead of errors
2016-10-11 17:30:13 +03:00
Alexander Udalov 8949ffbef1 Do not report deprecation on members of deprecated companion
This deprecation is reported on the companion itself anyway
2016-10-07 20:14:53 +03:00
Alexander Udalov 1e51ba7d00 Run classifier usage checkers for ambiguous references when possible
See comment in getReferencedClassifier and importJavaSamInterface.kt for
explanation
2016-10-06 14:40:21 +03:00
Alexander Udalov ec53efd869 Run classifier usage checkers after all imports are resolved
Otherwise the diagnostic was not reported on an unused import of a deprecated
class in diagnostic tests, see the test case
2016-10-06 14:40:20 +03:00
Alexander Udalov dca99c3fd2 Move ClassifierUsageChecker invocation lower in LazyTopDownAnalyzer
Invoking checkers right after resolution of qualified expressions is too early:
DeprecatedClassifierUsageChecker tries to load the annotations of a referenced
classifier to report deprecation, and that may result in building light classes
for not yet analyzed declarations

 #KT-13954 Fixed
2016-09-24 11:26:56 +03:00
Alexander Udalov 8357f3021e Do not report errors on fake elements in call checkers
#KT-12875 Fixed
2016-06-29 22:03:36 +03:00
Pavel V. Talanov c3a1643c6c Add test for obsolete KT-6481 Mark deprecated constructor calls with strikethrough 2016-03-09 18:41:00 +03:00
Pavel V. Talanov 7d98103c0c overriddenDescriptors is empty for java static property and function declarations
Fake overrides are still created for java static with non-empty overriddenDescriptors

Add tests for inheriting visibility for java static members
Add test: check that java static declarations that shadow deprecated declarations should not be deprecated
Add test for corner case where "overriding" java static constant led to incorrect type in inheritor

Fix test data for existing tests
2016-02-11 14:08:14 +03:00
Pavel V. Talanov db07d783a2 Member is considered deprecated if it overrides only deprecated members
Property accessor is considered deprecated when the property is
Provide IDE inspection to strikeout members overriding deprecated members (like in java)
2016-01-15 17:53:23 +03:00
Dmitry Petrov 9856af48ca Drop createQualifier: testData update 2015-11-18 14:35:53 +03:00
Dmitry Petrov b532fa2bbf Properly resolve values in 1st qualifier part (see implicitReceiverProperty test).
Look into QUALIFIER for left-most "unrolled" qualified expression
    in CallExpressionResolver#getQualifiedExpressionTypeInfo.
Drop some unused functions.
2015-11-18 14:35:53 +03:00
Dmitry Petrov eef8c7ae09 Move auxiliary methods for QualifierReceiver resolution to a separate file
(to be refactored later).
Get rid of duplicate type usage validation.
2015-11-18 14:35:53 +03:00
Dmitry Petrov 3556f9751e Reuse package/class qualifier prefix resolution for qualified expression resolution. 2015-11-18 14:35:52 +03:00
Alexey Tsvetkov dc27363452 Remove @annotation from test data 2015-10-19 20:45:01 +03:00