diff --git a/docs/diagnostics/5001.md b/docs/diagnostics/5001.md index 137a66a86..f9cc2e57c 100644 --- a/docs/diagnostics/5001.md +++ b/docs/diagnostics/5001.md @@ -32,7 +32,7 @@ val f = filter (** + undefined value: `filter` *) ``` -Confusingly, come functions like `map` are defined both in `List` and also aliased the top level. +Confusingly, some functions like `map` are defined both in `List` and also aliased the top level. ```sml val m1 = List.map @@ -65,20 +65,22 @@ val y : x = 5 ### Check signature ascription -The name may be explicitly not permitted to be accessed outside of a structure due to a signature ascription. - -Ascribing a structure to a more restrictive signature prohibits accessing the "extra" items inside the structure. +If the name is defined inside a structure, but the structure ascribes to a signature, and the signature does not include that name, then the name will not be available outside of the structure. ```sml signature SIG = sig - val foo : int + val inSigAndStruct : int end structure Str : SIG = struct - val foo = 3 - val bar = "hi" + val notInSig = "hi" + val inSigAndStruct = String.size notInSig end -val s = Str.bar -(** ^^^^^^^ undefined value: `bar` *) +(* this is fine *) +val n = Str.inSigAndStruct + +(* this is not *) +val s = Str.notInSig +(** ^^^^^^^^^^^^ undefined value: `notInSig` *) ```