Commit Graph

42037 Commits

Author SHA1 Message Date
Paul Merlin e911a1e53d Script template provider for settings.gradle.kts files
This commit introduces GradleSettingsKotlinDSLTemplateProvider and
registers it as Kotlin IntelliJ plugin extension.
2017-10-11 16:19:56 +02:00
xiexed 5c2962e195 UAST properly handles string "when conditions" in lazy parent (KT-20709) (#1338) 2017-10-11 15:16:15 +02:00
Mikhail Zarechenskiy 88595e1a58 Don't require to override abstract methods in expect class
#KT-16099 Fixed
2017-10-11 15:27:50 +03:00
Mikhail Zarechenskiy 5695e76a00 Prohibit inheritance by delegation in expect classes
#KT-20431 Fixed
2017-10-11 15:27:46 +03:00
Denis Zharkov 2e8cda8103 Temporary change default behavior for constructor call normalization
It's necessary to perform bootstrap and must be reverted after
2017-10-11 14:21:49 +03:00
Dmitry Jemerov 1d4c2e9223 Don't analyze temporary files created from destructuring declarations
They are known to not contain any synthetic accessor calls.
2017-10-11 13:20:05 +02:00
Dmitry Savvinov f5d40a1c98 Fix testdata in varargs tests
Testdata have been changed since 1.2. due to KT-20171.
2017-10-11 14:06:54 +03:00
Dmitry Savvinov eae9923dbe Add allowKotlinPackage AnalysisFlag
This flag is used internally by EffectSystem as a sign of compiling
stdlib. If this flag is present, then EffectSystem will read contracts
on functions and serialize them into metadata even if corresponding
LanguageFeatures are turned off. This is done solely for building
1.2-runtime with contracts in it without the need to turn on
LanguageFeatures manually.

======
This commit finishes a first series of commits related to effect
system. After it, compiler is ready to work with contracts, but it is
impossible to actually annotate anything, because there are no
contracts DSL in stdlib yet.
2017-10-11 13:40:16 +03:00
Dmitry Savvinov bdbb161cfa Effects: support called-in-place lambdas
Support initialization of local variables in capture, if that capture is
anonymous lambda that was passed to function which explicitly expressed
its intent to call closure "here and now"

Changes:
- LocalFunctionDeclarationInstruction made open

- Introduce InlinedLocalFunctionDeclarationInstruction, which is subtype
of LocalFunctionDeclarationInstruction with additional semantic: it
is statically known that this function will be called in-place and maybe
with some definite amount of invocations.

- Next-instruction of InlinedLocalFunctionDeclarationInstruction depends
on whether flow can exit its body normally, i.e. on wheter EXIT is
reachable. If flow can reach EXIT, then .next is just straight next
instruction, otherwise it's SINK.

- Take non-local instructions into consideration when analyzing
reachability. We didn't it before because no one ever needed proper
analysis. Now we have InlinedLocalFunctionDeclarationInstruction which
cares about proper reachability of EXIT.

- Pull control-flow information from
InlinedLocalFunctionDeclarationInstruction's EXIT into parent's
pseudocode, thus allowing it to participate in initialization/use
analysis.

- Change logic of 'isCapturedWrite' to not report
"CAPTURED_VAL_INITIALIZATION" if value is captured by the inline-lambda.

==========
Introduction of EffectSystem: 12/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov 0dd6d1f4c7 Effects: support assert-like contracts
- Support functions that explicitly express relation between successfull
return and passed arguments (e.g., 'check')
- Note that we have to correct resulting data flow for arguments *after*
resoling (because we get contracts only after resolving). To do so, we
have to extend MutableDataFlowInfoForArguments interface with
'updateResultInfo' method.

==========
Introduction of EffectSystem: 11/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov 72b0d31329 Effects: support contracts with conditional returns
Support functions which have explicitly expressed relation between
return-value and arguments. If we have observed that function returned
this value, get additional information from effect system.

==========
Effect System introduction: 10/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov 87b0bc43d5 Effects: support parsing of functions contracts
Make a fastcheck for a presence of contract-declaration in function
body of FunctionDescriptorResolver. If there's something that looks like
contract and we need resolve to make a final decision, then prepare
LazyContractProvider key in UserDataMap of function's descriptor.

Note that we can't passively wait with contracts resolving until the
function body is analyzed, because we may need it earlier. However, we
can't force body resolve straight during descriptors resolving, because
we can run into recursive problems. That's why we are saving deferred
resolving of functions body via LazyContractProvider.

Also, we have to pass DataFlowInfo into
initializeFunctionDescriptorAndExplicitReturnType, because we save
deferred body resolving inside, which needs DataFlowInfo.

==========
Effect System introduction: 9/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov 175d23155e Effects: add (de)serialization of contracts in metadata
- Introduce new definitions in descriptors.proto
- Add new corresponding values in Flags.java
- Introduce ContractSerializer and ContractDeserializer, responsible for
for conversion ContractDescription <-> ProtoBuf.Contract
- Add dependency of 'serialization' module on 'resolution' so that it
could see contracts model.

Note that here we do a lot of seemingly unnecessary hoops, which in fact
necessary to respect existing module system (in particular, to be able
to extract ContractDescription declarations from 'descriptors' module to
make them invisible from reflection)

==========
Effect System introduction: 8/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov 2c0ef592e6 Effects: add DSL for declaration of contracts
- Introduce DSL for declaration of contracts. Functions and classes in
this DSL do not bear any computational semantics: in fact, they all do
not exist on runtime. Whole work of extracting semantics from such calls
is done by special parts of compiler

- To make distinguishing those declarations more robust and
convenient, introduce internal annotation @ContractsDSL

- Turn off InlineChecker inside contracts DSL. We do this, because some
functions from DSL should take any possible lambda, so we can't write
any type besides 'Function<R>'. However, InlineChecker will complain if
we will pass inlined lambda in such function -- though, this is false
positive because we know that functions from contracts DSL will never be
executed

- Change testData on HierarchyTestWithLib, where new enum from
kotlin.internal changed expected output

==========
Effect System introduction: 7/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov b347e31fc4 Effects: add facade of EffectSystem
- Add facade of effect system in form of EffectSystem class, as well as
some other utility classes.

- Inject effect system facade classes into ExpressionTypingComponents

- Call to ContractParsingServices in ExpressionTypingVisitor to record
function contract (if any)

- Introduce FilteringTrace

- Create new FilteringTrace for statement in ExpressionTypingServices
that will serve as a cache for EffectSystem, filtering ES-related
slices from committing into parent.

- Extract and expose ConditionalDataFlowInfo

==========
Effect System introduction: 6/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov a46ccdbae1 Effects: add parsing of contracts from PSI
- Introduce part of effect system responsible for parsing
contracts which were expressed in sources using DSL from stdlib

- Add new errors to Errors.java related to contracts and corresponding
messages.

==========
Effect System introduction: 5/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov 32d80f322e Effects: add new slices in BindingContext
==========
Effect System introduction: 4/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov d2e582698e Effects: add interpreters of ContractDescription
Interpreters convert declarative representation of contracts
(ContractDescription) in internal representation convenient for usage
inside compiler (Computations, Effects, etc.)

==========
Effect System introduction: 3/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov afc15e9211 Effects: Add inner representation of contracts
Add model of contracts used by compiler during analysis. It should be
thought of as structure which used by the compiler to implement
semantics, expressed by the ContractDescription.

==========
Effect System introduction: 2/18
2017-10-11 13:34:54 +03:00
Dmitry Savvinov ba84bd3f19 Effects: Add declarations for description of contracts
Add ContractDescription structure which is used for declarative representation
of function's contract.

Also, add corresponding LanguageFeatures.

==========
This is the first commit from a series of 18 commits which gradually
introduce effect system into the compiler. All such commits will be
marked with appropriate comment and index in that series.

While each one of such commits separately shouldn't break compiler (i.e
you can checkout any of them and expect compiler to build and pass
tests successfully, e.g. for bissecting purposes), semantically they
all are one big feature and not entirely independent. Please bear that
in mind while working with/changing only some of them -- some strange
effects can happen.
2017-10-11 13:34:54 +03:00
Dmitry Jemerov ee72cc268c Fix NSEE if there's no JVM implementation module (KT-20638) 2017-10-11 12:27:01 +02:00
Dmitry Jemerov dc7ffdcbe4 Add missing read action 2017-10-11 12:26:59 +02:00
Dmitry Jemerov 6c7f558d36 Add missing FileModificationService call (EA-107395) 2017-10-11 12:26:39 +02:00
Dmitry Jemerov c2efdfe243 Add space before 'where' keyword
#KT-19213 Fixed
2017-10-11 12:25:53 +02:00
Dmitry Jemerov f2a7e7f238 Show argument name hints for function type calls only for known names
#KT-19216 Fixed
2017-10-11 12:25:52 +02:00
Dmitry Jemerov af09f5a49f Enable argument name hints for annotations
#KT-19146 Fixed
2017-10-11 12:25:51 +02:00
Nikolay Krasko 8a46968292 Fix JUnit3RunnerWithInners runner for gradle execution (KT-20684)
#KT-20684 Fixed
2017-10-11 12:43:44 +03:00
Nikolay Krasko aaa3dd8e70 Don't filter out inner classes when running tests (KT-20684)
#KT-20684 In Progress
2017-10-11 12:43:43 +03:00
Ilya Gorbunov 456c26cdae Remove "EXPERIMENTAL" from 1.2 version description in tests and gradle options 2017-10-11 08:50:30 +03:00
Ilya Gorbunov b901a8946c Set 1.2-SNAPSHOT in maven build 2017-10-11 08:50:30 +03:00
Ilya Gorbunov cffab8d3ef Set 1.2-SNAPSHOT in gradle build 2017-10-11 08:50:30 +03:00
Ilya Gorbunov 968c9c2034 Set LATEST_STABLE language version and current version of stdlib to 1.2 2017-10-11 08:50:30 +03:00
Sergey Igushkin 17eac133a2 (minor) Make a test running on Gradle 4.0+ check the classes correctly 2017-10-11 02:25:30 +03:00
Mikhail Zarechenskiy e9aad54664 Add intrinsics to mark and choose special api calls
#KT-20585 Fixed
2017-10-11 01:37:05 +03:00
Mikhail Glukhikh e37bfa13e3 Related to KT-20713: add test for find usages in script 2017-10-10 22:48:42 +03:00
Mikhail Glukhikh c5cb45794a Fix CCE in ReplaceAddWithPlusAssignIntention #KT-20183 Fixed 2017-10-10 22:48:39 +03:00
Mikhail Glukhikh fd95769780 Code cleanup: ReplaceAddWithPlusAssignIntention 2017-10-10 22:48:37 +03:00
Mikhail Glukhikh 45c9be2945 Fix problem with mutable map in "simplifiable call chain"
So #KT-20315 Fixed
2017-10-10 22:48:35 +03:00
Mikhail Glukhikh 8e59d3e379 Handle modifiers correctly in "val to object" #KT-18919 Fixed 2017-10-10 22:48:33 +03:00
Mikhail Glukhikh 0b5b5d8e89 Suggest primitive array type for collection literals in "add type" fix
So #KT-18549 Fixed
2017-10-10 22:48:30 +03:00
Mikhail Glukhikh e65112fcab Disable "Replace camel-case name with spaces" intention for JS / common
So #KT-18773 Fixed
2017-10-10 22:48:28 +03:00
Ilya Gorbunov 43e6106791 Bootstrap selection: allow to specify teamcity project with a parameter 2017-10-10 21:00:32 +03:00
Ilya Gorbunov 39c8bae134 Minor: move extra property initialization 2017-10-10 21:00:30 +03:00
Ilya Gorbunov 712d0e0777 Remove redundant repositories 2017-10-10 20:50:03 +03:00
Ilya Gorbunov 5f51a293ba Use 'idea' plugin to specify excluded dirs 2017-10-10 20:50:03 +03:00
Ilya Gorbunov a8766a00c6 Remove unused property jdk16.home 2017-10-10 20:50:03 +03:00
Zalim Bashorov a4722a4000 Make "js.tests" depends on ":kotlin-test:kotlin-test-js" since it's used on runtime inside JS tests.
Transform dependency on ":kotlin-stdlib-js" to testRuntime since it's required only on runtime.

And remove unnecessary dependency from jsCompilerTest.
2017-10-10 20:19:07 +03:00
Zalim Bashorov eb1c76ecc4 Make :kotlin-test-js:distJs depends on compileKotlin2Js to avoid running the task too early 2017-10-10 20:19:07 +03:00
Sergey Igushkin 205df7b1f3 ~ Remove debug port 2017-10-10 19:40:18 +03:00
Sergey Igushkin 8e967c9b6b Move existing multiplatform tests to separate class; add options test. 2017-10-10 19:40:18 +03:00