There are few more such places. Better fix would be to avoid
situation, when we need to fallback. So in every project these
settings are defined. It means "Latest stable" setting is not good.
#KT-26364 Fixed
Make it the same type as in case of an empty collection, so that
`emptyRange.random()` throws the same exception as `emptyRange.toList().random()`.
#KT-15539
Given there's a Random API in the stdlib, that generates all random primitives, this commit adds the possibility to generate random unsigned integers.
It uses the same implementation from Random.nextInt, nextLong and nextBytes, but uses the appropriate conversions from a signed type to an unsigned type.
The use of the same API guarantees that the distribution is uniform, but this commit adds some unit test to enforce that necessity.
Fixes #KT-25570
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.
- 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
'parseContract' is called only from
'ContractParsingServices.checkContractAndRecordIfPresent', and here we
already have checked that this call is indeed a contract call.
- 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
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) { ... }