From 9b6ae8cb8fc68eeedd725515d4bdd77754914056 Mon Sep 17 00:00:00 2001 From: David Gold Date: Sat, 8 Oct 2016 01:47:27 -0700 Subject: [PATCH] Fix issues noted in 18484 (#18824) --- doc/stdlib/base.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/stdlib/base.rst b/doc/stdlib/base.rst index e5d002b5baed5..435c662775994 100644 --- a/doc/stdlib/base.rst +++ b/doc/stdlib/base.rst @@ -854,6 +854,35 @@ Nullables julia> isnull(x) false +.. function:: unsafe_get(x) + + .. Docstring generated from Julia source + + Return the value of ``x`` for :obj:`Nullable` ``x``\ ; return ``x`` for all other ``x``\ . + + This method does not check whether or not ``x`` is null before attempting to access the value of ``x`` for ``x::Nullable`` (hence "unsafe"). + + .. doctest:: + + julia> x = Nullable(1) + Nullable{Int64}(1) + + julia> unsafe_get(x) + 1 + + julia> x = Nullable{String}() + Nullable{String}() + + julia> unsafe_get(x) + ERROR: UndefRefError: access to undefined reference + in unsafe_get(::Nullable{String}) at ./REPL[4]:1 + + julia> x = 1 + 1 + + julia> unsafe_get(x) + 1 + System ------