Skip to content

Commit d6393f2

Browse files
MaybeNull wrapper round nullness syntax removed and refactored for src/fsi/console.fs (#18201)
1 parent fbdb7cb commit d6393f2

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

src/fsi/console.fs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ open System.Collections.Generic
88
open System.Runtime.InteropServices
99
open FSharp.Compiler.DiagnosticsLogger
1010

11-
[<AutoOpen>]
12-
module internal ConsoleHelpers =
13-
14-
#if NO_CHECKNULLS
15-
type MaybeNull<'T when 'T : null> = 'T
16-
17-
// Shim to match nullness checking library support in preview
18-
let inline (|Null|NonNull|) (x: 'T) : Choice<unit,'T> = match x with null -> Null | v -> NonNull v
19-
#else
20-
type MaybeNull<'T when 'T : not null> = 'T | null
21-
#endif
22-
2311
type internal Style =
2412
| Prompt
2513
| Out
@@ -42,17 +30,17 @@ type internal History() =
4230
list.Clear()
4331
current <- -1
4432

45-
member _.Add (line: string MaybeNull) =
33+
member _.Add (line: string | null) =
4634
match line with
47-
| Null
35+
| null
4836
| "" -> ()
49-
| NonNull line -> list.Add(line)
37+
| _ -> list.Add(line)
5038

51-
member _.AddLast (line: string MaybeNull) =
39+
member _.AddLast (line: string | null) =
5240
match line with
53-
| Null
41+
| null
5442
| "" -> ()
55-
| NonNull line ->
43+
| _ ->
5644
list.Add(line)
5745
current <- list.Count
5846

0 commit comments

Comments
 (0)