Merge pull request #171 from Geod24/deprecation

Clean up std.json deprecation, remove DUB hack in CI
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2019-09-17 16:05:12 +02:00 committed by GitHub
commit a39d3537ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -41,8 +41,7 @@ branches:
- master - master
before_install: before_install:
# Use the dub-updating fork of the installer script until https://github.com/dlang/installer/pull/301 is merged - wget https://dlang.org/install.sh -O ~/dlang/install.dub.sh
- wget https://raw.githubusercontent.com/wilzbach/installer-dub/master/script/install.sh -O ~/dlang/install.dub.sh
- . $(bash ~/dlang/install.dub.sh -a dub) - . $(bash ~/dlang/install.dub.sh -a dub)
- dub --version - dub --version

View file

@ -301,7 +301,13 @@ private void init()
private T fromValue(T)(in JSONValue val) private T fromValue(T)(in JSONValue val)
{ {
import std.conv : to; import std.conv : to;
static if (is(T == bool)) return val.type == JSON_TYPE.TRUE; static if (is(T == bool)) {
// JSONType.TRUE has been deprecated in v2.087.0
static if (is(typeof(JSONType.true_)))
return val.type == JSONType.true_;
else
return val.type == JSON_TYPE.TRUE;
}
else static if (is(T : long)) return val.integer.to!T; else static if (is(T : long)) return val.integer.to!T;
else static if (is(T : double)) return val.floating.to!T; else static if (is(T : double)) return val.floating.to!T;
else static if (is(T == string)) return val.str; else static if (is(T == string)) return val.str;