File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
tests/fsharpqa/Source/InteractiveSession/Misc Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1194,7 +1194,7 @@ namespace Microsoft.FSharp.Text.StructuredFormat
11941194 | :? bool as b -> ( if b then " true" else " false" )
11951195 | :? char as c -> " \' " + formatChar true c + " \' "
11961196 | _ -> try let text = obj.ToString()
1197- text
1197+ if text = null then " " else text
11981198 with e ->
11991199 // If a .ToString() call throws an exception, catch it and use the message as the result.
12001200 // This may be informative, e.g. division by zero etc...
Original file line number Diff line number Diff line change 1+ // #Regression #NoMT #FSI
2+ // Microsoft.Analysis.Server overrides ToString() to return isNull
3+ // instead of a string. This would make FSI fail in pretty-printing
4+ // when displaying results.
5+ //<Expects status="success">val n : NullToString = </Expects>
6+
7+ type NullToString () =
8+ override __.ToString () = null ;;
9+
10+ let n = NullToString();;
11+ #q;;
12+
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ ReqENU SOURCE=E_InterfaceCrossConstrained02.fsx COMPILE_ONLY=1 FSIMODE=PIPE SC
2727
2828 SOURCE=EmptyList.fsx COMPILE_ONLY=1 FSIMODE=PIPE SCFLAGS="--nologo" # EmptyList.fsx
2929
30+ SOURCE=ToStringNull.fsx COMPILE_ONLY=1 FSIMODE=PIPE SCFLAGS="--nologo" # ToStringNull.fsx
31+
3032# These are the regression tests for FSHARP1.0:5427
3133# The scenario is a bit convoluted because of the way we end up doing the verification
3234# In the last 2 cases, the verification is achieved by dumping the output of FSI to a file
You can’t perform that action at this time.
0 commit comments