diff --git a/dub.json b/dub.json index 34bf9cf5..bc086988 100644 --- a/dub.json +++ b/dub.json @@ -42,10 +42,12 @@ { "name": "integration_tests", "targetType": "executable", + "dflags-dmd": ["-preview=in"], "dependencies": { - "dpq2": "*", - "gfm:math": "~>7.0.0" + "dpq2": { "version": "*", "dflags-dmd": ["-preview=in"] }, + "vibe-d:data": { "version": "*", "dflags-dmd": ["-preview=in"] }, + "gfm:math": "~>8.0.6" }, "configurations": [ { @@ -75,9 +77,11 @@ { "name": "example", "targetType": "executable", + "dflags": ["-preview=in"], "dependencies": { - "dpq2": "*" + "dpq2": { "version": "*", "dflags": ["-preview=in"] }, + "vibe-d:data": { "version": "*", "dflags": ["-preview=in"] }, }, "sourcePaths": [ "example" ] } diff --git a/src/dpq2/conv/to_d_types.d b/src/dpq2/conv/to_d_types.d index 2049222d..3130460b 100644 --- a/src/dpq2/conv/to_d_types.d +++ b/src/dpq2/conv/to_d_types.d @@ -154,7 +154,7 @@ Value[] deserializeRecord(in Value v) "Value length isn't enough to hold object body", __FILE__, __LINE__); immutable(ubyte)[] resData = data[0 .. size]; data = data[size .. $]; - res = Value(resData, oidType); + res = Value(resData.idup, oidType); } return ret; @@ -369,7 +369,7 @@ if( is(T == BitArray) ) ) ); - auto data = v.data; + auto data = v.data[]; size_t len = data.read!int; size_t[] newData; foreach (ch; data.chunks(size_t.sizeof)) diff --git a/src/dpq2/value.d b/src/dpq2/value.d index 06c02394..91ef1f46 100644 --- a/src/dpq2/value.d +++ b/src/dpq2/value.d @@ -51,7 +51,7 @@ struct Value this._oidType = oidType; } - @safe const pure nothrow @nogc + @safe const pure nothrow scope @nogc { /// Indicates if the value is NULL bool isNull() @@ -84,7 +84,8 @@ struct Value _oidType = type; } - immutable(ubyte)[] data() pure const + //TODO: replace template by return modifier + immutable(ubyte)[] data()() pure const scope { import std.exception; import core.exception; @@ -158,7 +159,7 @@ class ValueConvException : ConvException } } -package void throwTypeComplaint(OidType receivedType, string expectedType, string file = __FILE__, size_t line = __LINE__) pure +package void throwTypeComplaint(OidType receivedType, in string expectedType, string file = __FILE__, size_t line = __LINE__) pure { throw new ValueConvException( ConvExceptionType.NOT_IMPLEMENTED,