Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nullness - include in QuickInfo and in general in "typeEnc" (string representation of a type) #16555

Merged
merged 51 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f058226
failing test
T-Gro Dec 5, 2023
c24a746
todo for IL import
T-Gro Dec 5, 2023
37a2752
explanation added
T-Gro Dec 6, 2023
baca949
il meta parsing
T-Gro Dec 7, 2023
feeb098
flags evaluation
T-Gro Dec 7, 2023
cfa416f
you shall passs
T-Gro Dec 7, 2023
ac5ff27
evaluateFirstOrderNullnessAndAdvance
T-Gro Dec 7, 2023
62aa534
import il type with nullness
T-Gro Dec 11, 2023
06623df
type import
T-Gro Dec 12, 2023
2aa9722
IL nullness import
T-Gro Dec 12, 2023
469e10b
test rename
T-Gro Dec 12, 2023
db1bfac
fantomas
T-Gro Dec 12, 2023
b4551a7
Merge branch 'feature/nullness' into nullness-interop-import
T-Gro Dec 12, 2023
1e94203
Merge branch 'feature/nullness' into nullness-interop-import
T-Gro Dec 12, 2023
94e02aa
get stack trace on error
T-Gro Dec 12, 2023
4d2f36f
split ilmethod's type
T-Gro Dec 13, 2023
e186b6a
fix crashes for Csharp style extensions
T-Gro Dec 13, 2023
d084a93
solve coexistance of nullness and Is* properties of DUs
T-Gro Dec 14, 2023
8381659
updating tests
T-Gro Dec 14, 2023
eabfeaf
clean tests
T-Gro Dec 14, 2023
334b118
fantomas
T-Gro Dec 14, 2023
f16054e
fantomas one more time
T-Gro Dec 14, 2023
4ebb2cb
importing nullness for generic typars
T-Gro Dec 14, 2023
0d6d764
print failing ivals, let's see
T-Gro Dec 15, 2023
4b9b4b2
write even more!
T-Gro Dec 15, 2023
14cf8fa
isolated failing test - combo of module rec, signature file, IVT
T-Gro Dec 19, 2023
01d0671
another attempt
T-Gro Dec 20, 2023
e0e7c28
format
T-Gro Dec 20, 2023
92267fc
test
T-Gro Jan 3, 2024
3d2ed8b
hide tests
T-Gro Jan 4, 2024
affe0c8
Remove 'specialname' for DU case tester
T-Gro Jan 4, 2024
bba7521
format
T-Gro Jan 4, 2024
0055376
warning as error
T-Gro Jan 4, 2024
939f6da
update baseline netcore
T-Gro Jan 4, 2024
c781a6a
nullable errors not in desktop framework
T-Gro Jan 5, 2024
384cc32
surface area, trimming
T-Gro Jan 5, 2024
a0f19f8
surface area
T-Gro Jan 5, 2024
3567765
cosmetic cleanup & annotations
T-Gro Jan 5, 2024
cc37881
Rename to ILMethParentTypeInfo
T-Gro Jan 10, 2024
3c58861
making vMapFold tail recursive
T-Gro Jan 10, 2024
ab07699
physical nullnessEquiv
T-Gro Jan 10, 2024
b5522c8
format
T-Gro Jan 10, 2024
0e4a3e2
Commenting SkipNullness usages
T-Gro Jan 15, 2024
04ec256
Nullness work - activity module
T-Gro Jan 15, 2024
cd4632f
Remove strict generic 'T:null' import
T-Gro Jan 16, 2024
45a6bdf
Null|NonNull pattern also for regular compilation
T-Gro Jan 16, 2024
abe07b2
Backported Null|NonNull active pattern
T-Gro Jan 16, 2024
7a4dbf6
one more time
T-Gro Jan 16, 2024
1141fe4
revert
T-Gro Jan 16, 2024
eb3a612
Show nullness in quickinfo and in general in type representations
T-Gro Jan 19, 2024
e6c80b9
Merge branch 'feature/nullness' into nullness-quickinfo
T-Gro Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compiler/Symbols/SymbolHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ module internal SymbolHelpers =
let SimplerDisplayEnv denv =
{ denv with shortConstraints=true
showStaticallyResolvedTyparAnnotations=false
showNullnessAnnotations = Some false
showNullnessAnnotations = Some true
abbreviateAdditionalConstraints=false
suppressNestedTypes=true
maxMembers=Some EnvMisc2.maxMembers }
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/TypedTree/TypedTree.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4227,6 +4227,8 @@ type Nullness =

override n.ToString() = match n.Evaluate() with NullnessInfo.WithNull -> "?" | NullnessInfo.WithoutNull -> "" | NullnessInfo.AmbivalentToNull -> "%"

member n.ToFsharpCodeString() = match n.Evaluate() with NullnessInfo.WithNull -> " | null " | NullnessInfo.WithoutNull -> "" | NullnessInfo.AmbivalentToNull -> ""

// Note, nullness variables are only created if the nullness checking feature is on
[<NoComparison;NoEquality>]
type NullnessVar() =
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/TypedTree/TypedTree.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -3043,6 +3043,8 @@ type Nullness =

member TryEvaluate: unit -> NullnessInfo voption

member ToFsharpCodeString: unit -> string

[<NoComparison; NoEquality>]
type NullnessVar =
new: unit -> NullnessVar
Expand Down
24 changes: 12 additions & 12 deletions src/Compiler/TypedTree/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8776,26 +8776,26 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty =
let ety = destNativePtrTy g ty
typeEnc g (gtpsType, gtpsMethod) ety + "*"

| _ when isArrayTy g ty ->
let tcref, tinst = destAppTy g ty
| TType_app (_, _, nullness) when isArrayTy g ty ->
let tcref, tinst = destAppTy g ty
let rank = rankOfArrayTyconRef g tcref
let arraySuffix = "[" + String.concat ", " (List.replicate (rank-1) "0:") + "]"
typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix
typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix + nullness.ToFsharpCodeString()

| TType_ucase (_, tinst)
| TType_app (_, tinst, _) ->
let tyName =
let tyName,nullness =
let ty = stripTyEqnsAndMeasureEqns g ty
match ty with
| TType_app (tcref, _tinst, _) ->
| TType_app (tcref, _tinst, nullness) ->
// Generic type names are (name + "`" + digits) where name does not contain "`".
// In XML doc, when used in type instances, these do not use the ticks.
let path = Array.toList (fullMangledPathToTyconRef tcref) @ [tcref.CompiledName]
textOfPath (List.map DemangleGenericTypeName path)
textOfPath (List.map DemangleGenericTypeName path),nullness
| _ ->
assert false
failwith "impossible"
tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst
tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst + nullness.ToFsharpCodeString()

| TType_anon (anonInfo, tinst) ->
sprintf "%s%s" anonInfo.ILTypeRef.FullName (tyargsEnc g (gtpsType, gtpsMethod) tinst)
Expand All @@ -8806,11 +8806,11 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty =
else
sprintf "System.Tuple%s"(tyargsEnc g (gtpsType, gtpsMethod) tys)

| TType_fun (domainTy, rangeTy, _) ->
"Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy]
| TType_fun (domainTy, rangeTy, nullness) ->
"Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] + nullness.ToFsharpCodeString()

| TType_var (typar, _) ->
typarEnc g (gtpsType, gtpsMethod) typar
| TType_var (typar, nullness) ->
typarEnc g (gtpsType, gtpsMethod) typar + nullness.ToFsharpCodeString()

| TType_measure _ -> "?"

Expand All @@ -8822,7 +8822,7 @@ and tyargsEnc g (gtpsType, gtpsMethod) args =

let XmlDocArgsEnc g (gtpsType, gtpsMethod) argTys =
if isNil argTys then ""
else "(" + String.concat "," (List.map (typeEnc g (gtpsType, gtpsMethod)) argTys) + ")"
else "(" + String.concat "," (List.map (typeEnc g (gtpsType, gtpsMethod)) argTys) + ")"

let buildAccessPath (cp: CompilationPath option) =
match cp with
Expand Down
Loading