Commit Graph

9337 Commits

Author SHA1 Message Date
Ilya Chernikov 0b9770f8d1 Refactor scripting - rename env vars to provided properties everywhere 2018-12-13 18:00:12 +01:00
Pavel V. Talanov 1d7a74bfcd Minor: fix exception message 2018-12-13 14:35:04 +01:00
Mikhail Glukhikh 588e94b917 File rename: TargetPlatform.kt -> PlatformConfiguratorBase.kt
Made to match file content better
2018-12-11 22:07:41 +03:00
Simon Ogorodnik e3aed04d96 Extract module info & target platform to separate frontend.common 2018-12-11 22:07:41 +03:00
Mikhail Zarechenskiy e8a8318ead [NI] Fix input/output types for callable reference atom
Input and output types are crucial for type variable fixation order and
 analysis of postponed arguments (callable references, lambdas).

 Specifically, if there is non-fixed type variable inside input types of
 a callable reference, then we'll postpone resolution for such callable
 reference.

 Initial example with the expected type `KMutableProperty1<*, F>` caused
 problems because input types were computed incorrectly (while there
 aren't input types here)

 #KT-25431 Fixed
2018-12-11 11:33:29 +03:00
Mikhail Zarechenskiy 6ebbb6eae3 [NI] Fix not-null smartcast on intersection of nullable types
#KT-28670 Fixed
2018-12-11 11:29:59 +03:00
Dmitry Savvinov 500dc11514 Fix missed returned expression if the last expression was condition jump
See ticket comments for the detailed description

^KT-28061 Fixed
2018-12-10 13:38:43 +03:00
vitaly.khudobakhshov c901d6cebc Implement support for "resX" result fields in REPL 2018-12-05 16:01:32 +01:00
Dmitry Savvinov f174ee863d Don't run ExpectedActualDeclarationChecker on property accessors
One might think that it shouldn't be run because of 'if (declaration
!is KtNamedDeclaration) return' check in the 'check'-overload.

However, for default accessors we pass PSI for property, i.e.
KtProperty (see 'DeclarationCheckers.checkAccessors'), which
obviously passes this check

Note that we can't use `DescriptorToSourceUtils` here, because it's
returns `KtProperty` for default accessor too.

This commits adds specific check for that case, to avoid exception in
KT-28385. Ideal solution would be to either don't launch checkers on
such parameters, or explicitly declare semantic of the
'declaration'-parameter, e.g. to rename it to 'reportOn' (see KT-28403
for discussion)

^KT-28385 Fixed
2018-12-05 11:50:35 +03:00
Roman Artemev 30cc5f6d3c Support Ir Validation in phaser 2018-12-04 19:45:15 +03:00
Roman Artemev de1cbc396e Implement JS IR Phaser 2018-12-04 19:45:15 +03:00
Cuihtlauac ALVARADO 094dc2ae45 Remove useless parameter
Private function convertToOverloadResults() has two call sites, both:

* inside member functions of the NewResolutionOldInference class
* passing NewResolutionOldInference.languageVersionSettings

Therefore, it is safe to remove this parameter from the signature of
convertToOverloadResults(). The occurence of languageVerstionSetting
in it's return statement will refer (implicitly) to the definition from
its class.
2018-12-04 19:07:27 +03:00
Denis Zharkov 2182be82e6 Fix message text for INCOMPATIBLE_ENUM_COMPARISON
^KT-28516 Fixed
2018-11-30 10:34:00 +03:00
Georgy Bronnikov 32640750ee Add CompilerPhase and corresponding compiler keys 2018-11-29 12:48:52 +03:00
Yan Zhulanow 69633e6686 Kapt: Fix stubs for delegated properties with anonymous types (KT-27910) 2018-11-27 22:21:26 +09:00
Leonid Startsev a4a1df0a81 Add information about secondary constructors to synthetic classes.
Before this, descriptors for such constructors were created in-place where they needed by the codegens.
However, presence of symbol table in IR backend requires the single instance of constructor descriptor across all compilation to be able to reference it and create a symbol. This support of generics in kotlinx.serialization on Kotlin/Native.
2018-11-21 15:59:49 +03:00
Dmitry Savvinov c8cbe05722 [Minor] Add even more logging for EA-119635 2018-11-16 14:46:46 +03:00
Denis Zharkov aa63ad4a45 Report a warning when comparing incompatible enums
I've put `isIncompatibleEnums` to TypeIntersector because I placed
all of its usages after all of the TypeIntersector::isIntersectionEmpty ones

^KT-28225 Fixed
2018-11-16 10:36:09 +03:00
Alexander Udalov 49d6a7a7cb Refactor and improve code obtaining actual Java annotation parameter values
Extract Java-specific code into module 'frontend.java' and use already
existing JavaAnnotationArgument facilities to determine the default
parameter value in an actual Java annotation class.

Annotation arguments are not yet supported because to create an instance
of AnnotationValue, we need a descriptor, which is not available at this
point.

 #KT-22704 In Progress
 #KT-28077 Open
2018-11-13 19:05:14 +01:00
Ricardo Meneghin Filho c08540175b Allow expect annotations with actual typealias to Java have default arguments 2018-11-13 19:05:14 +01:00
Nikolay Krasko 2284028bbe Add bodyBlockExpression() helper function to KtDeclarationWithBody 2018-11-12 13:38:28 +03:00
Nikolay Krasko e2269e13af Move AstLoadingFilter to incompatible API and update usages 2018-11-12 13:38:26 +03:00
Nikolay Krasko d1e7229b7a Allow getting operation node in annotation qualified expressions for now 2018-11-12 13:38:24 +03:00
Nikolay Krasko ff9477554f Do not check and load psi for modifier list with stub 2018-11-12 13:38:22 +03:00
Nikolay Krasko 04559800f1 Ignore reporting "literal prefixes and suffixes" for stubbed elements 2018-11-12 13:38:21 +03:00
Nikolay Krasko 710f3e8551 Make an excuse for contracts for loading psi for now 2018-11-12 13:38:20 +03:00
Mikhail Zarechenskiy 021732f74a [NI] Consider type non-nullable only if it has non-null supertype
Fixes #KT-12684 for NI
2018-11-12 12:42:03 +03:00
Roman Artemev 8f2117685f [JS BE] Support contracts in JS Fix KT-27946 2018-11-08 17:35:06 +03:00
Mikhail Glukhikh caad0d5a74 ExposedVisibilityChecker refactoring: make trace BindingTrace 2018-11-08 17:16:06 +03:00
Mikhail Glukhikh d464b441c8 ExposedVisibilityChecker refactoring: extract 'reportExposure' 2018-11-08 17:16:06 +03:00
Mikhail Glukhikh b3857e85e0 Report exposed type for properties in class primary constructor
Before this commit, we compared property visibility with constructor
visibility only, which is incorrect. Now we compare property visibility
also with class visibility

#KT-19613 Fixed
2018-11-08 17:16:06 +03:00
Alexander Udalov 17d740a373 Do not try computing return type in OverloadChecker
Return type is not needed for checking overloads, but querying it may
involve resolving function bodies, which usually happens after overload
checking (see LazyTopDownAnalyzer.analyzeDeclarations) and at this point
can lead to incorrect BACKING_FIELD_REQUIRED value being computed for
some properties (see KT-27895)

 #KT-27895 Fixed
2018-11-07 11:00:15 +01:00
Alexander Udalov 911420d823 Minor, move InlineOnly-related utilities to frontend 2018-10-31 17:21:06 +01:00
Mikhail Glukhikh 318d6e7111 Introduce inspection for unused main parameter #KT-26999 Fixed 2018-10-31 19:00:29 +03:00
Mikhail Glukhikh ad44118605 Delay UNUSED_PARAMETER on main parameter until 1.4 (part of KT-26999) 2018-10-31 19:00:29 +03:00
Alexander Udalov 5bc2178040 Report warning instead of error on incorrect -Xuse-experimental/-Xexperimental
#KT-27430 Fixed
 #KT-27709 Fixed
2018-10-30 19:58:03 +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 c1ab08c8ce Refactor KClassValue to store ClassLiteralValue internally
Only invariant array projections and non-null element types will be
supported soon (see KT-26568), so it makes no sense to store the
complete type in KClassValue. What we need is only the ClassId of the
class, and the number of times it's wrapped into kotlin/Array, which is
exactly what ClassLiteralValue represents.

This change helps in decoupling annotation values from
descriptors/types. The only constant value that depends on descriptors
is now AnnotationValue.

 #KT-26582 Fixed
2018-10-25 16:27:23 +02:00
Alexander Udalov bad30a4b99 Add module to ExperimentalMarkerDeclarationAnnotationChecker
Will be used in a subsequent commit
2018-10-25 16:27:22 +02:00
Dmitry Savvinov 339c55505a Refactor logic of reporting errors in contracts
Rename 'doCheckContract' into 'parseContractAndReportErrors',
emphasizing that it works with definitely call to 'contract' from
stdlib.
In particular, it means that it should either return non-null
value or report some errors.

Note that this commit doesn't change behavior of this code (modulo cases
when something in 'parseContract' throws exception), but just refactors
the code to be more clear and easy to reason about.
2018-10-24 12:03:04 +03:00
Dmitry Savvinov 3dd4e9f04f Minor: use try-finally for setting LazyContractProvider
It conveys meaning of the code more celearly (because that's what we
want to do here: set LazyContractProvider no matter how code finished),
and also defends from several corner-cases (like, make sure that we
properly set LazyContractProvider even if doCheckContract has throw an
exception)
2018-10-24 12:03:04 +03:00
Mikhail Zarechenskiy bae3ff5211 Don't try parsing contract-like function not from kotlin package
Returning `null` from `doCheckContract` functions means that we
have failed to parse contract function and should report an error, but
if the called function isn't true contract, we shouldn't evaluate that code
at all.

 #KT-27758 Fixed
2018-10-24 12:03:04 +03:00
Mikhail Glukhikh 01091ba1aa Refactor getKotlinTypeWithPossibleSmartCastToFP and related parts 2018-10-18 10:27:19 +03:00
Alexander Udalov f868964e25 Fix most unchecked/deprecation javac warnings in compiler modules 2018-10-17 18:39:49 +02:00
Alexander Udalov 23c210e9f2 Use JvmWildcard on return type of getContributedVariables/getContributedFunctions 2018-10-17 18:39:49 +02:00
Mikhail Zarechenskiy fe233de825 Report error for Result as an extension receiver with safe call
#KT-27620 Fixed
2018-10-16 19:03:05 +03:00
Dmitry Petrov f68ce4b35b Support default parameter values for inline class constructors and funs
#KT-26908
 #KT-26554

Move default parameter value tests to separate directory
2018-10-15 12:21:14 +03:00
Dmitry Savvinov 99e1d4ab45 Check for the presence of dispatch receiver too in isEqualsDescriptor()
Otherwise, top-level function with the name 'equals' and suitable
signature will be (erroneously) treated as true 'equals' invocation,
leading to further exception (see EA-126602)
2018-10-15 10:54:39 +03:00
Natalia Selezneva c4aab8340b Do not store script definition in psiFile
This may cause problems when definitions are reordered or switched off
KT-27375 Fixed
2018-10-15 09:43:49 +03:00
Nikolay Krasko ac2bc22f54 Use information from stub for contracts presence 2018-10-12 18:21:39 +03:00