Skip to content

Commit

Permalink
alias Nullable.get this: improve deprecation grammar, fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
FeepingCreature committed Jun 6, 2019
1 parent 95246af commit 9afa647
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions std/typecons.d
Original file line number Diff line number Diff line change
Expand Up @@ -2960,7 +2960,6 @@ Params:
Gets the value if not null. If `this` is in the null state, and the optional
parameter `fallback` was provided, it will be returned. Without `fallback`,
calling `get` with a null state is invalid.
This function is also called for the implicit conversion to `T`.
Params:
fallback = the value to return in case the `Nullable` is null.
Expand All @@ -2982,7 +2981,7 @@ Returns:
}

///
deprecated
deprecated("Implicit conversion with `alias Nullable.get this` is deprecated. Please use `.get` explicitly.")
@system unittest
{
import core.exception : AssertError;
Expand All @@ -3000,7 +2999,7 @@ deprecated
assert(i == 5);
}

deprecated("Deprecated to rely on implicit Nullable.get. Please use .get explicitly instead.")
deprecated("Implicit conversion with `alias Nullable.get this` is deprecated. Please use `.get` explicitly.")
@property ref inout(T) get_() inout @safe pure nothrow
{
enum message = "Called `get' on null Nullable!" ~ T.stringof ~ ".";
Expand All @@ -3024,6 +3023,7 @@ deprecated
/**
Implicitly converts to `T`.
`this` must not be in the null state.
This feature is deprecated.
*/
alias get_ this;
}
Expand Down Expand Up @@ -3080,7 +3080,7 @@ auto nullable(T)(T t)
assertThrown!Throwable(a.get);
}

deprecated("Deprecated to rely on implicit Nullable.get. Please use .get explicitly instead.")
deprecated("Implicit conversion with `alias Nullable.get this` is deprecated. Please use `.get` explicitly.")
@system unittest
{
import std.exception : assertThrown;
Expand Down

0 comments on commit 9afa647

Please sign in to comment.