Commit Graph

483 Commits

Author SHA1 Message Date
Mikhael Bogdanov
2ed0cb2a89 Support type annotations
#KT-35843 Fixed
2020-01-09 14:00:11 +01:00
Ilya Chernikov
995c6a32b8 Allow only single expression eval in cli compiler and kotlin runner
#KT-35740 fixed
also add tests and drop logger usage in the cli dependencies manager:
the logger is normally unitialized in the usage scenarios, but related
warnings are annoying.
2020-01-09 10:51:25 +01:00
Sergey Igushkin
ed6034e449 Support generating a klib from common code with K2MetadataCompiler 2019-12-25 12:09:08 +03:00
Alexander Gorshenev
dc8240c24e Expect/actual support in klibs under -Xklib-mpp 2019-12-18 19:29:56 +03:00
Alexander Udalov
e009c7064e Add -Xopt-in command line argument
As per https://github.com/Kotlin/KEEP/pull/201
2019-12-17 18:17:48 +01:00
Alexander Udalov
33bc3db144 Deprecate -Xexperimental compiler argument
This option is not widely used and its implementation relies on a
complicated mechanism of a module-wide metadata, which is not properly
supported in the IDE (see IdeModuleAnnotationsResolver).

 #KT-34649 Fixed
2019-12-17 18:17:48 +01:00
Juan Chen
15f6beed57 Fix Compose extension points in compiler.xml 2019-12-12 18:30:54 +03:00
Ilya Chernikov
354be2b14f [minor] Change expression evaluation cli argument to -Xexpression 2019-12-11 12:20:49 +01:00
Ilya Chernikov
531ff92791 Implement support for expression evaluation in jvm cli compiler 2019-12-02 16:46:54 +01:00
Anton Bannykh
81699299f5 JS_IR: DCE
Could be enabled by toggling `-Xir-dce`

Box test output in js/js.translator/testData/out-min
2019-11-26 12:20:39 +03:00
Svyatoslav Kuzmich
42c4591df8 [JS IR] Add -Xgenerate-dts CLI argument 2019-11-12 18:19:06 +03:00
Dmitriy Novozhilov
45523a5767 Fix -Xuse-mixed-named-arguments compiler arg 2019-11-08 15:30:04 +03:00
Nikolay Krasko
155a760ee9 Revert "Revert [JS IR] commits that failed build"
This reverts commit 740f851a
2019-11-07 16:24:13 +03:00
Leonid Startsev
3b100e57f2 Change NO_EXPLICIT_VISIBILITY_IN_API_MODE diagnostic range to 'declaration modifiers + name'.
Motivation: missing visibility modifier is an error in visibility modifiers list, so we should highlight this list.
Including a name in the range is convenient for using alt+enter (you don't have to move cursor from name to fun/class/val keyword)

 Also change NO_EXPLICIT_RETURN_TYPE_IN_API_MODE diagnostic range to 'declaration name' to match corresponding IDE inspection.

Fix stylistic problems and typos after review
2019-11-06 19:54:00 +03:00
Leonid Startsev
ebb7e434c8 Explicit Api mode: Renamings after design discussions
Change CLI flag to -Xexplicit-api=strict|warning. 'Disable' state and 'mode' suffix are left out as implementation details.

Change intention title to 'make X public explicitly'

Do not report 'no explicit visibility' on property accessors

Set DECLARATION_SIGNATURE as a range for report

Rename internal diagnostic from _MIGRATION to _WARNING
2019-11-06 19:53:59 +03:00
Leonid Startsev
7058492b55 Explicit Api mode: prototype with check for missing explicit visibility
Add cli flag with 3-state switch
2019-11-06 19:53:58 +03:00
Dmitriy Novozhilov
7f58162abc Add -Xuse-mixed-named-arguments compiler flag
That flags enables MixedNamedArgumentsInTheirOwnPosition feature
  (see #KT-7745) without experimental warning
2019-11-05 15:22:23 +03:00
Nikolay Krasko
740f851a10 Revert [JS IR] commits that failed build
Revert "[JS IR] Build hybrid versions of stdlib and kotlin.test"
This reverts commit b9f88350dd.

Revert "[JS IR] Add gradle plugin integration tests"
This reverts commit d872b27663.

Revert "Update bootstrap"
This reverts commit bc47594c7a.

Revert "[JS IR] Support generating both IR and pre-IR libraries"
This reverts commit 1b8df45bfe.
2019-11-05 13:58:39 +03:00
Svyatoslav Kuzmich
1b8df45bfe [JS IR] Support generating both IR and pre-IR libraries
Remove all previous -Xir options

Add:
 -Xir-produce-klib-dir
 -Xir-produce-klib-file
 -Xir-produce-js
 -Xir-only
2019-11-01 19:42:05 +03:00
Alexander Udalov
df4ab4ed81 Add JVM bytecode target version 13
#KT-34119 Fixed
2019-10-29 12:54:24 +01:00
Pavel Semyonov
c6f54b6412 Improve descriptions of compiler options 2019-10-25 19:26:19 +02:00
Stanislav Erokhin
352a4dc836 Added extension points to the second compiler.xml
This is a workaround for KT-34528.
Extension points from 26728711
2019-10-23 18:14:35 +03:00
Jim Sproch
383239aff6 Make useIR available from Gradle KotlinJvmOptions 2019-10-21 13:20:54 +03:00
Alexander Udalov
d0b241b681 Minor, fix typo in -include-runtime argument help
#KT-34240 Fixed
2019-10-16 15:00:03 +02:00
Ilya Gorbunov
941980c154 Cleanup FE analysis flag allowKotlinPackage
It was used to allow custom contracts when compiling stdlib
with the Kotlin 1.2 compiler. Since 1.3 compiler is used now, this
flag is no longer necessary.
2019-10-15 19:08:57 +03:00
Ilya Chernikov
2568804eaa Instruct platform code to use NIO2 always
since we're not always use jna (means that we can get warnings about missing jna libs)
and according to the IDEA team, NIO2 works well enough to rely on it
2019-10-11 17:43:49 +02:00
Vitaliy.Tikhonov
f59e393e37 [CLI] add support running scripts in js compiler, extract common code with jvm part 2019-10-10 12:52:06 +03:00
Anton Bannykh
ead8379c50 JS: add -Xmetadata-only flag for JS common code modules (KT-33142 fixed) 2019-09-27 19:12:03 +03:00
Dmitry Savvinov
bfacc1a3c5 Introduce AbstractResolverForProject
Previously, ResolverForProjectImpl had multiple callbacks in
constructor. Some of those callbacks were used only to overcome module
visibility and provide an ability to inject IDE-specific logic into
compiler (ResolverForProject is in the 'compiler'-module)

This commit introduces abstract class which implements
environment-independent logic (previously, this logic had been stored in
ResolverForProjectImpl) with several abstract met hods (previously,
callbacks). Then, we provide few concrete implementations of
AbstractResolverForProject with clear semantics:

- IdeaResolverForProject: resolver used in IDE, where we have indices,
  oracles, multiple modules, etc.
- ResolverForSingleModuleProject: resolver for project with only one
  module, commonly used for CLI compiler/tests
- one anonymous implementation for MultimoduleTests

This refactoring achieves several things:
- now it is easier to see what kinds of ResolverForProject you might see
  in some particular environment (previously, one had to inspect all
  call-sites of constructor)
- we can easily add IDE-specific logic in IdeaResolverForProject without
  adding noisy callbacks (which most probably wouldn't have any other
  non-trivial implementations)
2019-09-24 17:05:05 +03:00
Alexander Udalov
6ef434a711 JVM IR: add -Xir-check-local-names to check names for consistency
Since KotlinTypeMapper is no longer used in the JVM IR backend, we need
not run CodegenBinding.initTrace and check that names of local entities
are exactly equal to local names computed by that algorithm.

However, it's still useful as an opt-in flag, to discover issues where
unwanted elements take part in the naming (such as temporary IR
variables, see for example cb2e68fece). So we introduce a new command
line argument -Xir-check-local-names which, when the IR backend is used
(via -Xuse-ir), launches the name computation algorithm from the old
backend and then compares that the names are exactly equal to the names
computed by the IR backend in InventNamesForLocalClasses.
2019-09-18 17:55:42 +02:00
Dmitry Savvinov
0065236bde Move default implementation of TargetPlatform.platformName to leaf classes
Otherwise, we have a static initialization loop, leading to null-leaks

Removing default interface method indeed disconnects the loop, as per JVM
Specification, "5.5 Initialization".

See KT-33245 for detailed explanations

^KT-33245 Fixed
2019-08-12 13:06:51 +03:00
Mikhail Zarechenskiy
04e57f712e [NI] Introduce feature for passing function references with defaults
Relates to KT-8834, we continue reducing differences between old and new
 inference. Note that as for `SamConversionPerArgument`, this feature
 is enabled in the compiler and not in the IDE to avoid breaking code
 for those users that already enabled new inference in the compiler
2019-08-07 15:58:36 +03:00
Dmitry Savvinov
2b4d70fcf0 [Resolve] Rewrite how built-ins are created
Under COMPOSITE mode we don't have a globally known way to create
built-ins, instead, we have to create them on per-module basis.

So, in this commit we:

1. Use builtInsProvider: (ModuleInfo) -> KotlinBuiltIns instead of
precomputed builtIns instance, in order to be able to calculate
builtIns on per-module basis

2. Introduce new entity, called BuiltInsCache, which, roughly
speaking, is a map of form ModuleInfo -> KotlinBuiltIns, to prevent
creation of multiple builtInsInstances
NB. Actually, it's of form BuiltInsCacheKey -> KotlinBuiltIns, because
we shouldn't create new builtIns for each module. Also, currently,
each platform has its own BuiltInsCacheKey implementation, because
parameters by which built-ins are created, are a bit different across
different platforms. Ideally, we should eliminate those differences
and they use one concrete implementation as a key.
2019-07-30 12:41:40 +03:00
Dmitry Savvinov
b48218e722 [Resolve] Make ResolversForModule less static
As consequence, remove IdePlatformKindTooling.resolverForModule, because
it became more than just field, and it duplicates similar API in
IdePlatformKindResolution anyways
2019-07-30 12:41:40 +03:00
Ilya Chernikov
0072f8c265 Improve JSR-223 engine diagnostics
also abstract invoke wrapper creation
2019-07-26 08:55:14 +02:00
Victor Petukhov
e25b315319 Introduce -Xpolymorphic-signature compiler flag as more priority than -XXLanguage:+PolymorphicSignature 2019-07-26 09:01:25 +03:00
Victor Petukhov
944ee8fcd5 Introduce -Xinline-classes compiler flag as more priority than -XXLanguage:+InlineClasses 2019-07-26 09:01:25 +03:00
Ilya Chernikov
9ae0ff03fa Improve script and REPL result handling:
- implement error result
- refactor other result classes
- implement handling in the script evaluation extension - also restores
  previous script error reporting functionality
- add possibility to customize result fileds in script and REPL
- refactor result calculation in the backend: cleanup, rename (since
  it is not only about REPL now)
2019-07-11 15:50:26 +02:00
Andrey Uskov
e079615cdf Add possibility to edit target platform for non-HMPP projects in order to keep ability to edit target platform for IDEA-based projects 2019-07-02 22:46:48 +03:00
Andrey Uskov
9fc60be9d8 Fix serialization of facet settings in order to read properly
settings of native platforms
2019-07-02 22:46:47 +03:00
Nikolay Krasko
12bb1a5bd1 Make invalidateOnOOCB explicit in ResolverForProjectImpl and remove usage in tests 2019-07-02 13:45:35 +03:00
Mikhail Zarechenskiy
c2cf4aa2b5 [NI] Move ability to convert standalone SAM-argument under the feature
If new inference is enabled only for IDE analysis, then this feature
 will be disabled to reduce difference between new and old inference,
 but if new inference is enabled in the compiler, then this feature
 will be enabled too to preserve behavior of new inference for
 compilation

 #KT-32175 Fixed
 #KT-32143 Fixed
 #KT-32123 Fixed
 #KT-32230 Fixed
2019-07-01 12:53:33 +03:00
Vyacheslav Gerasimov
fc68bb46dc Build: Move compiler.xml extensions to cli-common 2019-06-27 17:56:51 +03:00
Roman Artemev
cc46657c99 [JS IR BE] Fix misprint 2019-06-14 18:40:59 +03:00
Andrey Uskov
c0bf5a6566 Import of middle HMPP target platforms is supported 2019-06-13 18:30:01 +03:00
Dmitry Savvinov
174ef56991 [Expect/Actual] Remove PlatformExpectedAnnotator 2019-06-10 13:34:27 +03:00
Mikhail Zarechenskiy
787a8bb9bd Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit 7c4101e21c.

 #KT-31866 Fixed
 #KT-31868 Fixed
 #EA-125401 Fixed
 #KT-25290 Open
2019-06-07 12:31:38 +03:00
Svyatoslav Kuzmich
cd651be461 [JS IR BE] Migrate JS BE to common klib utils 2019-06-05 11:15:45 +03:00
Dmitriy Novozhilov
7c4101e21c [NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI 2019-05-29 10:35:46 +03:00
Mikhail Zarechenskiy
848640253a Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit f20ec3e0a6.
2019-05-29 01:31:28 +03:00