Commit Graph

180 Commits

Author SHA1 Message Date
Dmitriy Novozhilov
d01b6ef900 Revert "[NI] Support @OnlyInputTypes annotation. #KT-29307 fixed"
This reverts commit 90628112
With that annotation there is complex bug that breaks build of Kotlin compiler
2019-03-18 18:53:38 +03:00
Dmitriy Novozhilov
9062811231 [NI] Support @OnlyInputTypes annotation. #KT-29307 fixed
Also KT-26698 fixed in new inference
2019-03-15 10:39:11 +03:00
Alexander Udalov
59fda8d7ce Support JvmPackageName with JvmMultifileClass
This is an internal feature of our standard library needed to compile
new API for unsigned types
2019-03-06 15:34:23 +01: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
30762a450a Wrap diagnostic parameters to double quotes and split by comma instead of semicolon 2019-02-14 12:31:42 +03:00
victor.petukhov
46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00
Dmitriy Novozhilov
0501a108c0 Fix tests in DiagnosticsTestWithStdLibGenerated with NI 2019-02-01 11:40:20 +03:00
Mikhail Zarechenskiy
e4a4d1169e Prohibit JvmOverloads on constructors of annotation classes
In LV >= 1.4 & -progressive

 #KT-25702 Fixed
2018-12-24 12:48:00 +03:00
Alexander Udalov
37e1b486f4 Minor, remove obsolete API_VERSION directives 2018-12-20 12:53:23 +01:00
Alexander Udalov
e3c381a298 Remove API_VERSION 1.3 from tests on JvmDefault
So that these tests will now check behavior on the latest API version
2018-12-20 12:53:23 +01: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
f63cf9d506 Use JvmName on kotlin.Metadata parameters to improve public API
#KT-26359 Fixed
2018-09-12 14:37:11 +03:00
Mikhail Zarechenskiy
7b70c1a2d9 Allow kotlin.Result only for declarations that are effectively fields 2018-09-11 10:39:25 +03:00
Mikhail Zarechenskiy
e5ee142208 Prohibit @JvmField on properties of inline class types
#KT-26454 Fixed
2018-09-11 10:39:17 +03:00
Mikhail Zarechenskiy
55ef96e5c9 Prohibit @JvmName on functions that are assumed to be mangled
#KT-26454 In Progress
2018-09-11 10:39:16 +03:00
Alexander Udalov
0fa2d29779 Fix test data in annotationsOnUseSiteTargets.kt
After the initial commit fc87043cb3 has been authored, master has
advanced to 1.3 where this diagnostic had slightly changed
2018-09-07 00:14:33 +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
Alexander Udalov
f423403167 Make kotlin.Metadata public
Prohibit explicit usage of `@Metadata` to prevent possible
AnnotationFormatError at runtime

 #KT-23602 Fixed
2018-08-30 14:50:25 +03:00
Mikhail Zarechenskiy
34cd0e9f6c Do not report warning about useless annotations for JvmStatic properties
#KT-25745 Fixed
2018-08-08 15:47:25 +03:00
Dmitry Petrov
acf0bb349c Update testData for restricted expression annotations retention 2018-07-20 10:39:51 +03:00
Dmitry Petrov
5767f84c0e Restrict retention for annotations with target EXPRESSION
#KT-13762 Fixed
2018-07-18 14:21:03 +03:00
Mikhael Bogdanov
52b261e19e Fix test data 2018-07-17 13:30:43 +02:00
Mikhail Zarechenskiy
b6db8971e4 Warn about annotations that targets non-existing accessors
#KT-15453 In Progress
2018-07-17 00:22:53 +03:00
Mikhael Bogdanov
1d283d243e Support @JvmField on interface properties
#KT-15807 Fixed
2018-07-16 16:13:15 +02:00
Mikhael Bogdanov
eb745133c9 Switch @JvmStatic diagnostic test to LanguageFeature usage 2018-07-10 16:04:30 +02:00
Alexander Udalov
984e37c7f1 Prohibit explicit usage of kotlin.Metadata as annotation 2018-06-27 12:37:18 +02:00
Mikhael Bogdanov
065780de4c Switch enableJvmDefault to jvmDefaultMode 2018-05-28 22:15:42 +02:00
Mikhail Glukhikh
e76debb12b Report UNUSED_PARAMETER in setter #KT-21129 Fixed 2018-05-04 18:04:57 +03:00
Mikhael Bogdanov
56d1184515 Restrict conditions for @JvmDefault super calls
Condition was too strict
  if @JvmDefault implicitly hidden by class in inheritance.
  Diagnostic is redundant cause there isn't breaking
  change depending on interface method generation strategy and
  delegating stub generation in inheriting class.
2018-04-10 16:33:26 +02:00
Mikhael Bogdanov
6d1af263ba Restrict conditions for @JvmDefault super calls
Condition was too strict if we actually make super call
  through super class. Diagnostic is redundant cause there isn't breaking
  change depending on interface method generation strategy.
2018-04-10 16:33:25 +02:00
Mikhael Bogdanov
c5d4f22e4f Add quick fix for adding @JvmDefault annotation 2018-04-09 18:13:36 +02:00
Mikhael Bogdanov
31e459d9c0 Fix misspelling in test data 2018-04-09 18:13:35 +02:00
Mikhael Bogdanov
d788b3b6f9 Add warning on overriding java default by non @JvmDefault method 2018-04-09 18:13:35 +02:00
Mikhael Bogdanov
cb9c1ae104 Support default method super calls within @JvmDefault ones 2018-04-09 18:13:34 +02:00
Mikhael Bogdanov
08ff1de248 Update test data 2018-04-03 19:38:37 +02:00
Mikhael Bogdanov
2c56f0bfd3 Require 'jvmDefaultFlag' for default super calls 2018-04-03 19:18:19 +02:00
Mikhael Bogdanov
23e8adb793 Add custom diagnostic checker for @JvmDefault annotation 2018-04-03 19:18:17 +02:00
Mikhael Bogdanov
38f8924ae3 Update test data. Use simple ''@JvmDefault' instead full qualifier 2018-04-03 19:18:15 +02:00
Mikhael Bogdanov
1d3e57acee Add @JvmDefault diagnostics 2018-04-03 19:18:10 +02:00
Mikhael Bogdanov
5830f99bce Remove unused test data 2018-04-03 19:18:08 +02:00
Mikhail Zarechenskiy
4ebd11a7ae Refactoring: rename parameter to argument for annotation diagnostics 2018-03-22 03:59:55 +03:00
Mikhael Bogdanov
c4da370b0b Allow to use @JvmStatic in interface companion object 2018-01-26 10:09:20 +01:00
Alexander Udalov
a46a2b9b1c Support nested classes in annotation classes
#KT-16962 In Progress
2018-01-24 15:54:35 +01:00
Alexander Udalov
7f8634d9ef Revert "Temporarily remove JvmPackageName and tests, but keep the implementation"
This reverts commit 9ae6feb2c5.
2017-10-11 19:20:24 +03:00
Dmitry Savvinov
87b85ce978 Fix testdata for tests which use varargs
Change tests to use new syntax for array literals to prevent deprecation
warnings (see KT-20171).
2017-10-11 18:06:00 +03:00
Dmitry Petrov
26136cd0fe Check constness of 'apiVersionIsAtLeast' arguments 2017-10-10 09:04:51 +03:00
Alexander Udalov
9ae6feb2c5 Temporarily remove JvmPackageName and tests, but keep the implementation
This is needed because we want the compiler code to stay as much the
same in master and in 1.2 as possible
2017-09-13 23:23:36 +03:00
Alexander Udalov
e8e38d90ff Validate JvmPackageName annotation value and placement
- do not allow it to be used together with JvmMultifileClass (otherwise
  implementation becomes complex)
- do not allow to declare classes in a JvmPackageName-annotated file
  (similarly, the implementation of this would be much harder in the
  compiler, and there would need to be special support in the IDE)
- check that the value is a valid FQ name
- do not allow root package just in case
2017-09-13 22:59:03 +03:00
Mikhail Glukhikh
7a53b2f4c8 Introduce UNUSED_ANONYMOUS_PARAMETER for anonymous functions
It is not reported for 1.0 language version because
renaming to _ is not possible. It has weak warning severity

So #KT-8813 Fixed
So #KT-16875 Fixed
2017-04-04 14:23:30 +03:00