Commit Graph

353 Commits

Author SHA1 Message Date
Nikolay Krasko b9872b7651 Render annotations in suspend functions in single modifier list (KT-20185)
#KT-20185 Fixed
2017-09-14 12:28:26 +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
Alexander Udalov 234148518e Temporarily remove isInitialized 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 22:51:23 +03:00
Alexander Udalov c6263ac8e6 Support isInitialized intrinsic for lateinit properties
See https://github.com/Kotlin/KEEP/pull/73

 #KT-9327 Fixed
2017-09-13 22:49:26 +03:00
Denis Zharkov d6fbb084b1 Use the same temporary trace for analyzing all candidate calls
Otherwise, when completing all the unsuccessfull candiates,
resolution of each lambda-arguments starts repeatedly for each candidate
that leads to exponential time

NB: Changes in `completeArguments` are necessary because otherwise
nested lambdas will be analyzed twice:
once for the main resolved call, and then for all candidates
that again leads to exponential complexity

 #KT-16672 Fixed
 #KT-19457 Fixed
2017-08-30 12:51:29 +03:00
baratynskiy 01883a41cb javac-wrapper: refactoring, fixes and tests 2017-08-29 18:01:36 +03:00
Alexander Udalov 472959aca1 Improve rendering of modifiers in DescriptorRenderer
* Use bold font to render all modifiers
* Render 'external' according to the style guide, right after modality
2017-08-25 15:35:05 +03:00
Alexander Udalov 770441c212 Merge "diagnostic with Java 8" tests with general diagnostic tests 2017-08-17 13:15:18 +03:00
Mikhail Zarechenskiy e2dcf47b3b Fix highlighting range of diagnostic in test data
Because of ae3497c6ce
2017-08-08 00:29:18 +03:00
Mikhail Zarechenskiy 3fb865e07c Move test for NI to diagnostic tests and add "todo" 2017-08-07 18:01:16 +03:00
Dmitry Petrov 26cc08be65 Fix anonymous function literals handling in type checker
- [NI] Create type info directly if the expected type is functional.
- Properly handle suspended function expected type.
2017-08-07 18:00:21 +03:00
Denis Zharkov bc564af2fc Regenerate mockJDK using openJDK 7 2017-06-24 17:26:01 +03:00
Mikhail Zarechenskiy 9847278699 Report error about invalid if as expression on the if keyword
#KT-14633 Fixed
2017-06-22 14:18:11 +03:00
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00
Mikhail Zarechenskiy 7541a3754d Move SAM constructors to synthetic scope 2017-05-05 21:30:35 +03:00
Mikhail Zarechenskiy 95ede7fb67 Move SAM adapters from static scope to synthetic one 2017-05-05 21:30:10 +03:00
Mikhail Zarechenskiy 32f609ceee Check lambda parameter for name shadowing
#KT-5160 Fixed
2017-04-17 17:12:44 +03:00
Mikhail Zarechenskiy 0d6b7bb6a1 Prohibit check for instance of a non-reified, non-subtype type parameter
#KT-12683 Fixed
 #KT-9986 Fixed
2017-04-05 21:35:07 +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
Mikhail Zarechenskiy 8466270bdb Check that arguments of array function call in annotation are constants
#KT-16956 Fixed
2017-03-22 17:59:58 +03:00
Alexander Udalov 32826c1686 Introduce LanguageFeature.State, drop coroutines-related pseudofeatures
Previously there were three LanguageFeature instances -- Coroutines,
DoNotWarnOnCoroutines and ErrorOnCoroutines -- which were handled very
awkwardly in the compiler and in the IDE to basically support a language
feature with a more complex state: not just enabled/disabled, but also
enabled with warning and enabled with error. Introduce a new enum
LanguageFeature.State for this and allow LanguageVersionSettings to get
the state of any language feature with 'getFeatureSupport'.

One noticeable drawback of this approach is that looking at the API, one
may assume that any language feature can be in one of the four states
(enabled, warning, error, disabled). This is not true however; there's
only one language feature at the moment (coroutines) for which these
intermediate states (warning, error) are handled in any way. This may be
refactored further by abstracting the logic that checks the language
feature availability so that it would work exactly the same for any
feature.

Another issue is that the difference among ENABLED_WITH_ERROR and
DISABLED is not clear. They are left as separate states because at the
moment, different diagnostics are reported in these two cases and
quick-fixes in IDE rely on that
2017-03-15 11:03:00 +03:00
Alexander Udalov a9678010a8 Invert LanguageFeature responsible for warning on coroutines
The problem was that LanguageVersionSettingsImpl.DEFAULT did not have
"WarnOnCoroutines" as a feature and so it was manually added to the settings,
but only in two places: in the compiler and in the IDE
2017-02-22 18:55:48 +03:00
Ilya Gorbunov 5867d27fb7 [Standard Library] Take the javaClass deprecation back as its replacement is often inconvenient. 2017-02-22 17:27:20 +03:00
Stanislav Erokhin b6fa10cf9e Disable some features when LV=1.1 API=1.0.
Feature list:
 - bound callable references
 - local delegated properties
 - coroutines.

#KT-16017 Fixed
2017-02-13 20:29:38 +03:00
Denis Zharkov 80638ebc99 Prohibit unsupported suspend operators
contains/get/set operators don't work properly on both backends

Also add box test checking that 'compareTo' operator works just fine

 #KT-16219 Fixed
2017-02-08 11:07:27 +03:00
Denis Zharkov 4921bd822d Mark as UNSUPPORTED suspension points in default parameters
#KT-16124 Fixed
 #KT-16218 Open
2017-02-08 11:07:26 +03:00
Ilya Gorbunov b8de78dd43 Deprecate javaClass with replacement this::class.java.
Suppress deprecation in diagnostics tests.
2017-02-07 16:30:22 +03:00
Mikhail Zarechenskiy d7093db5c5 Allow to use emptyArray in annotation as argument
#KT-14236 Fixed
2017-02-07 14:07:20 +03:00
Mikhail Zarechenskiy 655cf82534 Copy compileTimeInitializer for const property descriptor
#KT-15802 Fixed
2017-02-07 14:07:06 +03:00
Alexander Udalov b780e6d374 Do not import "kotlin.comparisons" by default for language version 1.0
#KT-16199 Fixed
2017-02-07 10:15:57 +03:00
Denis Zharkov 2d88419c38 Fix annotation deserialization on suspend functions
Use proper initial/frontend version of suspend descriptor
when writing METHOD_FOR_FUNCTION, because serializer uses this version

Also this commit contains adjustments of neighboring code to the describe
change

 #KT-16093 Fixed
2017-02-03 16:44:22 +03:00
Denis Zharkov 60c2579436 Allow destructuring in suspend lambda with suspend componentX
#KT-16113 Fixed
2017-02-03 10:32:28 +03:00
Denis Zharkov e9262b875b Implement makeNullableAsSpecified for TypeTemplate properly
This change fixes an SOE in isCastErased:
    @JvmStatic
    fun isCastErased(supertype: KotlinType, subtype: KotlinType, typeChecker: KotlinTypeChecker): Boolean {
        if (supertype.isMarkedNullable || subtype.isMarkedNullable) {
            return isCastErased(TypeUtils.makeNotNullable(supertype), TypeUtils.makeNotNullable(subtype), typeChecker)
        }

TypeUtils.makeNotNullable(TypeTemplate) should not return the same object
if isMarkedNullable returned true on the instance


 #KT-15516 Fixed
2017-02-01 11:51:15 +03:00
Denis Zharkov 39fc1789e0 Prohibit inline lambda parameters of suspend function type
#KT-16068 Fixed
2017-01-31 14:55:48 +03:00
Stanislav Erokhin 2aa2df75ae Make property java available on KClass<T> where T is type parameter without upper bounds. 2017-01-28 03:25:43 +03:00
Denis Zharkov c362a9154b Rename SUSPENDED_MARKER to COROUTINE_SUSPENDED 2017-01-27 23:24:13 +03:00
Denis Zharkov 1d5144b168 Move coroutine-related diagnostic tests to run them with stdlib
It's necessary because all coroutine related declarations (Continuation, etc)
are now in the stdlib
2017-01-27 23:24:13 +03:00
Dmitry Petrov de14d4abc8 KT-15748 Type alias constructor return type should have a corresponding abbreviation 2017-01-27 15:16:04 +03:00
Dmitry Petrov 5ef27f7ad3 KT-15010 Missing error on an usage non-constant property in annotation default argument 2017-01-24 17:52:52 +03:00
Mikhail Glukhikh 60fcdeb5ee Test added: suppress on function reference #KT-15839 Obsolete 2017-01-24 14:59:53 +03:00
Mikhail Zarechenskiy e448695578 Introduce language feature for refined sam adapters priority 2016-12-27 16:44:23 +03:00
Mikhail Zarechenskiy 24d5bdd62c Fix test data after migration to 'rem' 2016-12-20 15:20:47 +03:00
Ilya Gorbunov 9acfde7c5a Revert changes from daac46b since kotlin.Comparator now has lower priority than explicit star-import of java.util.* 2016-12-15 13:39:10 +03:00
Alexey Andreev dadffebe97 Support external modifier in descriptor renderer. Update test data. 2016-12-08 15:41:43 +03:00
Alexey Andreev 7e37d5d6fa Prohibit external modifiers on classes and properties in JVM target 2016-12-08 15:41:42 +03:00
Mikhail Zarechenskiy 240d82d167 Move reified type parameter checker to additional checkers to able turn it off by demand 2016-12-01 10:06:38 +03:00
Dmitry Jemerov b8525de726 Disallow @JvmOverloads on any interface methods
#KT-12224 Fixed
2016-11-18 11:05:02 +01:00
Dmitry Jemerov 79e90b32e8 @JvmOverloads on local declarations is now an error 2016-11-18 11:05:01 +01:00
Dmitry Jemerov 12e4cf9a4f Report @JvmOverloads errors on annotation, not on entire declaration (KT-12701) 2016-11-18 11:05:00 +01:00