Commit Graph

48463 Commits

Author SHA1 Message Date
Dmitry Petrov db131df751 Don't mangle function names with 'kotlin.SuccessOrFailure' 2018-08-30 16:20:55 +03:00
Ilmir Usmanov e8597d706d Implement debug-friendly Continuation.toString()
#KT-18986 Fixed
2018-08-30 16:20:52 +03:00
Dmitry Savvinov 4929f457ed Turn off BooleanElvisBoundSmartCasts in 1.3
See KT-26357
2018-08-30 16:20:49 +03:00
Ilya Gorbunov 3607ed85ab Update public API dump with mangled signatures 2018-08-30 16:20:45 +03:00
Ilya Gorbunov e670318cf0 ifEmpty and isBlank extensions
- Introduce ifEmpty extension for Collections, Maps, Arrays, Sequences
- Introduce ifEmpty and isBlank for CharSequences

#KT-15695 Fixed
2018-08-30 16:20:42 +03:00
Alexey Tsvetkov 4f6d9e7b86 Update bootstrap 2018-08-30 16:20:39 +03:00
Dmitry Savvinov 2179ae496e Fix testdata after improvements in contract parsing diagnostics 2018-08-30 16:20:36 +03:00
Dmitry Savvinov a6bb7d1e89 Support identity equals in contracts 2018-08-30 16:20:32 +03:00
Dmitry Savvinov cf033fa78a Minor: extract common equals processing in a separate method 2018-08-30 16:20:29 +03:00
Dmitry Savvinov 70dc6ef0f7 Minor: detect 'returns()' more accurately
Before, we've assumed that if call has no expression arguments, then
it's a 'returns()' call.

Now we check that we've resolved to overload of 'returns' from
ContractsDsl with zero parameters.
2018-08-30 16:20:26 +03:00
Dmitry Savvinov 1300a475db Improve diagnostics for illegal constructions in contract-block
Like 'if', 'when', etc: they can have type of 'Effect', so we would try
to parse them and then fail silently.
2018-08-30 16:20:23 +03:00
Dmitry Savvinov ca20c0b0bd Improve diagnostics for unrecognized InvocationKind in contracts 2018-08-30 16:20:19 +03:00
Dmitry Savvinov e40f11ec52 Improve diagnostics for contract-calls when not lambda-literal passed 2018-08-30 16:20:16 +03:00
Dmitry Savvinov 90e37c6599 Improve diagnostics for illegal contract targets 2018-08-30 16:20:13 +03:00
Dmitry Savvinov a9c388ecc7 Forbid referencing captured types and generics in contracts 2018-08-30 16:20:10 +03:00
Dmitry Savvinov 749fa049ca Refactor diagnostic reporting of effects parsing
- Introduce ContractParsingDiagnosticsCollector
It allows us to make sure that we return 'null'-contract iff there's
some error. Note that it differs from previous behavior in two major
points:
a) if contract was unparsed, but no error were reported for
some reason, then generic error will be reported (previously we were
swallowing incorrect contract silently)
b) if there were some errors during parsing, return only 'null'
(previously, we could return some contract. It was unusable due to
errors in code, but we want to be extra-safe here)

- Introduce ContractCallContext to not pass a bunch of random arguments
around

- Make message of Error.CONTRACT_NOT_ALLOWED more flexible
2018-08-30 16:20:07 +03:00
Dmitry Savvinov a6783176ea Add tests on illegal usages of Contracts DSL
(currently with undesired behavior, it will be fixed in the next
commits)
2018-08-30 16:20:04 +03:00
Dmitry Savvinov 79476839c4 Minor: remove unneeded check from contract parsing
'parseContract' is called only from
'ContractParsingServices.checkContractAndRecordIfPresent', and here we
already have checked that this call is indeed a contract call.
2018-08-30 16:20:01 +03:00
Dmitry Savvinov e29de37ac4 Fix JS IR BlackBox tests after contracts publishing
- Add necessary files to compilation
- Opt-in for experimentality

See changes at e2606b72bdbec2fea567d4127197707869eb801e
2018-08-30 16:19:58 +03:00
Dmitry Savvinov ee8702d21e Load of testdata change due to contracts publishing
See changes in e2606b72bdbec2fea567d4127197707869eb801e
2018-08-30 16:19:55 +03:00
Dmitry Savvinov accbd07b2e Publish ContractsDsl
- Mark @ContractsDsl as @Experimental
- Move Contracts DSL out from 'internal' package
- Change visibility of ContractsDsl from 'internal' to 'public'

^KT-25274 Fixed
^KT-25495 Fixed
2018-08-30 16:19:51 +03:00
Ilmir Usmanov 208c3a51ab Use short jvm names for the annotation parameters 2018-08-30 16:19:44 +03:00
Ilmir Usmanov 22f9a6ce08 Add coroutines debug metadata: compiler
#KT-25557 Fixed
 #KT-25559 Fixed
2018-08-30 16:19:41 +03:00
Ilmir Usmanov c4287118d8 Add coroutines debug metadata: stdlib 2018-08-30 16:19:38 +03:00
Ilmir Usmanov fe451dce31 Implement correct is check for SuspendFunction
Add test for suspend functions with language version 1.2.
Minor edit in SuspendFunction docs.
2018-08-30 16:17:46 +03:00
Dmitry Petrov a205019156 Additional tests and fixes for function name mangling 2018-08-30 14:58:54 +03:00
Dmitry Petrov 99498eb7b8 Use 'name-hash' mangling scheme
'-' is allowed as a name character both in JVM and in Dalvik, but can't
be a part of a Java identifier.
2018-08-30 14:58:52 +03:00
Dmitry Petrov a56d1d3ce8 Mangle function names with inline class parameters
Avoid name clashes in cases such as

  inline class Login(val login: String)
  inline class Password(val password: String)

  fun validate(login: Login) { ... }
  fun validate(password: Password) { ... }
2018-08-30 14:58:50 +03:00
Dmitry Petrov ff9ba97d66 Minor: fix warnings and reformat 2018-08-30 14:58:47 +03:00
Alexey Sedunov c7a5a7ebd5 Gradle: Use common language/api version (if any) of all modules for project
#KT-26290 Fixed
2018-08-30 14:58:45 +03:00
Denis Zharkov c6eaaac877 Adjust coroutines test data to changing the default LV to 1.3 2018-08-30 14:58:43 +03:00
Denis Zharkov f594cb22e8 Add "LANGUAGE_VERSION: 1.2" directive where it's necessary 2018-08-30 14:58:41 +03:00
Ilya Gorbunov f5df53b7a7 Detect UInt/ULong parsing overflow after digit addition instead of before
#KT-26161
2018-08-30 14:58:39 +03:00
Ilya Gorbunov d99f97ad96 Support '+' in front of parsed unsigned string values
#KT-26161
2018-08-30 14:58:37 +03:00
Ilya Gorbunov 2530a8e98c Provide unsigned string to number conversion in arbitrary base
#KT-26161
2018-08-30 14:58:35 +03:00
Ilya Gorbunov c1d1a7108f Provide unsigned number to string conversion in arbitrary base
#KT-26161
2018-08-30 14:58:33 +03:00
Ilya Gorbunov 47162590eb Add a credit for Guava implementation of unsigned division and remainder 2018-08-30 14:58:30 +03:00
Ilya Gorbunov abdd971d92 More contentHashCode tests for arrays 2018-08-30 14:58:28 +03:00
Ilya Gorbunov 4df665bc78 Generate extensions for unsigned arrays and provide tests for them
- contentEquals, contentToString, contentHashCode
- as[Signed]Array, as[Unsigned]Array
- to[Signed]Array, to[Unsigned]Array
- toTypedArray
- copyOf(), copyOf(newSize), copyOfRange(...)
2018-08-30 14:58:26 +03:00
Ilya Gorbunov 6360cc3cb5 Unsigned arrays: expose storage field as internal PublishedApi
To be able to write basic extensions that access storage array.
2018-08-30 14:58:24 +03:00
Ilya Gorbunov 6d33313d2e Regenerate range iteration tests 2018-08-30 14:58:22 +03:00
Ilya Gorbunov 3d2eb36486 Generate until, downTo, step, reversed functions for unsigned ranges/progressions 2018-08-30 14:58:20 +03:00
Ilya Gorbunov add0894f54 Support unsigned types and array specializations in stdlib generator 2018-08-30 14:58:18 +03:00
Ilya Gorbunov 76ff4c9b2f Remove custom hashCode and equals from unsigned types
The generated ones are ok now (on JVM)
2018-08-30 14:58:16 +03:00
Ilya Gorbunov f367322084 Introduce associateWith and associateWithTo functions
#KT-13814
2018-08-30 14:58:14 +03:00
Ilya Gorbunov 751e844258 Support having primary type parameter other than T in generated code
With some limitations: the primary parameter cannot have constraints for now.
2018-08-30 14:58:11 +03:00
Roman Elizarov 929064dfa7 Adjust SequenceBuilder to the new coroutines API
* Continuation.resumeWith(SuccessOrFailure)
* createCoroutineUnintercepted

(cherry picked from commit 8bbd78c)
2018-08-30 14:58:09 +03:00
Ilya Gorbunov 6400687f2a Restore experimental SequenceBuilder 2018-08-30 14:58:07 +03:00
Ilya Gorbunov 0ceceaaa6a Restore history of SequenceBuilder from experimental coroutines 2018-08-30 14:58:05 +03:00
Ilya Gorbunov 47996dbf47 Temporary remove SequenceBuilder 2018-08-30 14:58:03 +03:00