Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/AbstractIL/ilnativeres.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type WORD = uint16

let inline WORD s = uint16 s

type ResourceException(name: string, ?inner: Exception MaybeNull) =
type ResourceException(name: string, ?inner: (Exception | null)) =
inherit Exception(name, Option.toObj inner)

type RESOURCE_STRING() =
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/AbstractIL/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ type WeakByteFile(fileName: string, chunk: (int * int) option) =
let fileStamp = FileSystem.GetLastWriteTimeShim fileName

/// The weak handle to the bytes for the file
let weakBytes = WeakReference<byte[] MaybeNull>(null)
let weakBytes = WeakReference<byte[] | null>(null)

member _.FileName = fileName

Expand Down
8 changes: 4 additions & 4 deletions src/Compiler/AbstractIL/ilreflect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ let emEnv0 =
delayedFieldInits = []
}

let envBindTypeRef emEnv (tref: ILTypeRef) (typT: Type MaybeNull, typB, typeDef) =
let envBindTypeRef emEnv (tref: ILTypeRef) (typT: Type | null, typB, typeDef) =
match typT with
| Null -> failwithf "binding null type in envBindTypeRef: %s\n" tref.Name
| NonNull typT ->
Expand Down Expand Up @@ -697,7 +697,7 @@ let rec convTypeSpec cenv emEnv preferCreated (tspec: ILTypeSpec) =
let typT = convTypeRef cenv emEnv preferCreated tspec.TypeRef
let tyargs = List.map (convTypeAux cenv emEnv preferCreated) tspec.GenericArgs

let res: Type MaybeNull =
let res: Type | null =
match isNil tyargs, typT.IsGenericType with
| _, true -> typT.MakeGenericType(List.toArray tyargs)
| true, false -> typT
Expand Down Expand Up @@ -1013,7 +1013,7 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) : MethodInfo =
else
queryableTypeGetMethodBySearch cenv emEnv parentT mref

let nonQueryableTypeGetMethod (parentTI: Type) (methInfo: MethodInfo) : MethodInfo MaybeNull =
let nonQueryableTypeGetMethod (parentTI: Type) (methInfo: MethodInfo) : MethodInfo | null =
if
(parentTI.IsGenericType
&& not (equalTypes parentTI (getTypeConstructor parentTI)))
Expand Down Expand Up @@ -1102,7 +1102,7 @@ let queryableTypeGetConstructor cenv emEnv (parentT: Type) (mref: ILMethodRef) =
)
| NonNull res -> res

let nonQueryableTypeGetConstructor (parentTI: Type) (consInfo: ConstructorInfo) : ConstructorInfo MaybeNull =
let nonQueryableTypeGetConstructor (parentTI: Type) (consInfo: ConstructorInfo) : ConstructorInfo | null =
if parentTI.IsGenericType then
TypeBuilder.GetConstructor(parentTI, consInfo)
else
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/AbstractIL/ilsign.fs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ let RSAParametersFromBlob blob keyType =
key.D <- reader.ReadBigInteger byteLen
key

let validateRSAField (field: byte array MaybeNull) expected (name: string) =
let validateRSAField (field: byte array | null) expected (name: string) =
match field with
| Null -> ()
| NonNull field ->
Expand Down Expand Up @@ -237,7 +237,7 @@ let toCLRKeyBlob (rsaParameters: RSAParameters) (algId: int) : byte array =

buffer

let safeArrayRev (buffer: _ MaybeNull) =
let safeArrayRev (buffer: _ | null) =
match buffer with
| Null -> Array.empty<byte>
| NonNull buffer -> buffer |> Array.rev
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Checking/AccessibilityLogic.fs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ let IsPropInfoAccessible g amap m ad = function
| ProvidedProp (amap, tppi, m) as pp->
let access =
let a = tppi.PUntaint((fun ppi ->
let tryGetILAccessForProvidedMethodBase (mi : ProvidedMethodInfo MaybeNull) =
let tryGetILAccessForProvidedMethodBase (mi : (ProvidedMethodInfo | null)) =
match mi with
| Null -> None
| NonNull mi ->
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/Checking/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ module ProvidedMethodCalls =
allArgs: Exprs,
paramVars: Tainted<ProvidedVar>[],
g, amap, mut, isProp, isSuperInit, m,
expr: Tainted<ProvidedExpr MaybeNull>) =
expr: Tainted<(ProvidedExpr | null)>) =

let varConv =
// note: Assuming the size based on paramVars
Expand All @@ -1881,8 +1881,8 @@ module ProvidedMethodCalls =
dict.Add(v, (None, e))
dict

let rec exprToExprAndWitness top (ea: Tainted<ProvidedExpr MaybeNull>) =
let fail() = error(Error(FSComp.SR.etUnsupportedProvidedExpression(ea.PUntaint((fun etree -> etree.UnderlyingExpressionString), m)), m))
let rec exprToExprAndWitness top (ea: Tainted<(ProvidedExpr | null)>) =
let fail() = error(Error(FSComp.SR.etUnsupportedProvidedExpression(ea.PUntaint((fun etree -> match etree with null -> "<null>" | e -> e.UnderlyingExpressionString), m)), m))
match ea with
| Tainted.Null -> error(Error(FSComp.SR.etNullProvidedExpression(ea.TypeProviderDesignation), m))
| Tainted.NonNull ea ->
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Checking/import.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type AssemblyLoader =
/// Get a flag indicating if an assembly is a provided assembly, plus the
/// table of information recording remappings from type names in the provided assembly to type
/// names in the statically linked, embedded assembly.
abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted<ProvidedAssembly MaybeNull> -> bool * ProvidedAssemblyStaticLinkingMap option
abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted<(ProvidedAssembly | null)> -> bool * ProvidedAssemblyStaticLinkingMap option

/// Record a root for a [<Generate>] type to help guide static linking & type relocation
abstract RecordGeneratedTypeRoot : ProviderGeneratedType -> unit
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Checking/import.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type AssemblyLoader =
/// table of information recording remappings from type names in the provided assembly to type
/// names in the statically linked, embedded assembly.
abstract GetProvidedAssemblyInfo:
CompilationThreadToken * range * Tainted<ProvidedAssembly MaybeNull> ->
CompilationThreadToken * range * Tainted<(ProvidedAssembly | null)> ->
bool * ProvidedAssemblyStaticLinkingMap option

/// Record a root for a [<Generate>] type to help guide static linking & type relocation
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/Checking/infos.fs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ let CrackParamAttribsInfo g (ty: TType, argInfo: ArgReprInfo) =
type ILFieldInit with

/// Compute the ILFieldInit for the given provided constant value for a provided enum type.
static member FromProvidedObj m (v: obj MaybeNull) =
static member FromProvidedObj m (v: obj | null) =
match v with
| Null -> ILFieldInit.Null
| NonNull v ->
Expand Down Expand Up @@ -393,8 +393,8 @@ let OptionalArgInfoOfProvidedParameter (amap: ImportMap) m (provParam : Tainted<
NotOptional

/// Compute the ILFieldInit for the given provided constant value for a provided enum type.
let GetAndSanityCheckProviderMethod m (mi: Tainted<'T :> ProvidedMemberInfo>) (get : 'T -> ProvidedMethodInfo MaybeNull) err =
match mi.PApply((fun mi -> (get mi :> ProvidedMethodBase MaybeNull)),m) with
let GetAndSanityCheckProviderMethod m (mi: Tainted<'T :> ProvidedMemberInfo>) (get : 'T -> (ProvidedMethodInfo | null)) err =
match mi.PApply((fun mi -> (get mi :> (ProvidedMethodBase | null))),m) with
| Tainted.Null -> error(Error(err(mi.PUntaint((fun mi -> mi.Name),m),mi.PUntaint((fun mi -> (nonNull mi.DeclaringType).Name), m)), m))
| Tainted.NonNull meth -> meth

Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/CodeGen/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12194,7 +12194,7 @@ let LookupGeneratedValue (cenv: cenv) (ctxt: ExecutionContext) eenv (v: Val) =
if hasLiteralAttr then
let staticTy = ctxt.LookupTypeRef fspec.DeclaringTypeRef
// Checked: This FieldInfo (FieldBuilder) supports GetValue().
(!!staticTy.GetField(fspec.Name)).GetValue(null: obj MaybeNull)
(!!staticTy.GetField(fspec.Name)).GetValue(null: obj | null)
else
let staticTy = ctxt.LookupTypeRef ilContainerTy.TypeRef
// We can't call .Invoke on the ILMethodRef's MethodInfo,
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/DependencyManager/DependencyProvider.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ type DependencyProvider =

/// Returns a formatted help messages for registered dependencymanagers for the host to present
member GetRegisteredDependencyManagerHelpText:
string seq * string MaybeNull * sdkDirOverride: string option * ResolvingErrorReport -> string[]
string seq * (string | null) * sdkDirOverride: string option * ResolvingErrorReport -> string[]

/// Clear the DependencyManager results caches
member ClearResultsCache:
string seq * string MaybeNull * sdkDirOverride: string option * ResolvingErrorReport -> unit
string seq * (string | null) * sdkDirOverride: string option * ResolvingErrorReport -> unit

/// Returns a formatted error message for the host to present
member CreatePackageManagerUnknownError:
Expand All @@ -123,7 +123,7 @@ type DependencyProvider =
packageManagerTextLines: (string * string) seq *
reportError: ResolvingErrorReport *
executionTfm: string *
[<Optional; DefaultParameterValue(null: string MaybeNull)>] executionRid: string MaybeNull *
[<Optional; DefaultParameterValue(null: (string | null))>] executionRid: (string | null) *
[<Optional; DefaultParameterValue("")>] implicitIncludeDir: string *
[<Optional; DefaultParameterValue("")>] mainScriptName: string *
[<Optional; DefaultParameterValue("")>] fileName: string *
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Driver/CompilerImports.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ and [<Sealed>] TcImports
| _ -> None

#if !NO_TYPEPROVIDERS
member tcImports.GetProvidedAssemblyInfo(ctok, m, assembly: Tainted<ProvidedAssembly MaybeNull>) =
member tcImports.GetProvidedAssemblyInfo(ctok, m, assembly: Tainted<(ProvidedAssembly | null)>) =
match assembly with
| Tainted.Null -> false, None
| Tainted.NonNull assembly ->
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/Driver/FxResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ type internal FxResolver
let mutable errorslock = obj
let mutable outputlock = obj

let outputDataReceived (message: string MaybeNull) =
let outputDataReceived (message: string | null) =
match message with
| Null -> ()
| NonNull message -> lock outputlock (fun () -> outputList.Add(message))

let errorDataReceived (message: string MaybeNull) =
let errorDataReceived (message: string | null) =
match message with
| Null -> ()
| NonNull message -> lock errorslock (fun () -> errorsList.Add(message))
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</ItemGroup>

<ItemGroup>
<Compile Include="Utilities\NullnessShims.fs" />
<Compile Include="Utilities\NullHelpers.fs" />
<EmbeddedText Include="FSComp.txt">
<Link>FSComp.txt</Link>
</EmbeddedText>
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Facilities/CompilerLocation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module internal FSharpEnvironment =

let FSharpProductName = UtilsStrings.SR.buildProductName (FSharpBannerVersion)

let versionOf<'t> : MaybeNull<string> =
let versionOf<'t> : (string | null) =
match typeof<'t>.Assembly.GetName().Version with
| null -> null
| v -> v.ToString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ let private SimulatedMSBuildResolver =
let isDesktop = typeof<int>.Assembly.GetName().Name = "mscorlib"

if isDesktop then
match (System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(): string MaybeNull) with
match (System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(): string | null) with
| null -> []
| x -> [ x ]
else
Expand Down
20 changes: 12 additions & 8 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ type ILMultiInMemoryAssemblyEmitEnv
let typT = convTypeRef tref
let tyargs = List.map convTypeAux tspec.GenericArgs

let res: Type MaybeNull =
let res: Type | null =
match isNil tyargs, typT.IsGenericType with
| _, true -> typT.MakeGenericType(List.toArray tyargs)
| true, false -> typT
Expand Down Expand Up @@ -974,11 +974,15 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s
let executableFileNameWithoutExtension =
lazy
let getFsiCommandLine () =
let fileNameWithoutExtension (path: string MaybeNull) = Path.GetFileNameWithoutExtension(path)
let fileNameWithoutExtension (path: string | null) = Path.GetFileNameWithoutExtension(path)

let currentProcess = Process.GetCurrentProcess()
let mainModule = currentProcess.MainModule
let processFileName = fileNameWithoutExtension (mainModule ^ _.FileName)

let processFileName =
match mainModule with
| null -> null
| m -> fileNameWithoutExtension m.FileName

let commandLineExecutableFileName =
try
Expand Down Expand Up @@ -2468,7 +2472,7 @@ type internal FsiDynamicCompiler
member _.DynamicAssemblies = dynamicAssemblies.ToArray()

member _.FindDynamicAssembly(name, useFullName: bool) =
let getName (assemblyName: AssemblyName) : string MaybeNull =
let getName (assemblyName: AssemblyName) : string | null =
if useFullName then
assemblyName.FullName
else
Expand Down Expand Up @@ -3316,7 +3320,7 @@ type internal MagicAssemblyResolution() =
fsiDynamicCompiler: FsiDynamicCompiler,
fsiConsoleOutput: FsiConsoleOutput,
fullAssemName: string
) : Assembly MaybeNull =
) : Assembly | null =

try
// Grab the name of the assembly
Expand Down Expand Up @@ -3472,7 +3476,7 @@ type internal MagicAssemblyResolution() =
fsiDynamicCompiler: FsiDynamicCompiler,
fsiConsoleOutput: FsiConsoleOutput,
fullAssemName: string
) : Assembly MaybeNull =
) : Assembly | null =

//Eliminate recursive calls to Resolve which can happen via our callout to msbuild resolution
if MagicAssemblyResolution.resolving then
Expand Down Expand Up @@ -3534,7 +3538,7 @@ type FsiStdinLexerProvider
lexResourceManager: LexResourceManager
) =

let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) (readF: unit -> string MaybeNull) =
let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) (readF: unit -> string | null) =
UnicodeLexing.FunctionAsLexbuf(
true,
tcConfigB.langVersion,
Expand Down Expand Up @@ -3578,7 +3582,7 @@ type FsiStdinLexerProvider
// Reading stdin as a lex stream
//----------------------------------------------------------------------------

let removeZeroCharsFromString (str: string MaybeNull) : string MaybeNull =
let removeZeroCharsFromString (str: string | null) : string | null =
match str with
| Null -> str
| NonNull str ->
Expand Down
8 changes: 4 additions & 4 deletions src/Compiler/Service/QuickParse.fs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ module QuickParse =
let pos = r + MagicalAdjustmentConstant
Some(ident, pos, false))

let GetCompleteIdentifierIslandImpl (lineStr: string MaybeNull) (index: int) : (string * int * bool) option =
let GetCompleteIdentifierIslandImpl (lineStr: string | null) (index: int) : (string * int * bool) option =
match lineStr with
| Null -> None
| NonNull lineStr -> GetCompleteIdentifierIslandImplAux lineStr index
Expand Down Expand Up @@ -208,7 +208,7 @@ module QuickParse =
/// a call to `DeclItemsForNamesAtPosition` for intellisense. This will
/// allow us to use find the correct qualified items rather than resorting
/// to the more expensive and less accurate environment lookup.
let GetCompleteIdentifierIsland (tolerateJustAfter: bool) (lineStr: string MaybeNull) (index: int) : (string * int * bool) option =
let GetCompleteIdentifierIsland (tolerateJustAfter: bool) (lineStr: string | null) (index: int) : (string * int * bool) option =
if String.IsNullOrEmpty lineStr then
None
else
Expand Down Expand Up @@ -274,7 +274,7 @@ module QuickParse =
let result = InResidue(index, index)
result

let GetPartialLongName (lineStr: string MaybeNull, index: int) =
let GetPartialLongName (lineStr: string | null, index: int) =
match lineStr with
| Null -> defaultName
| NonNull lineStr -> GetPartialLongNameAux(lineStr, index)
Expand Down Expand Up @@ -429,7 +429,7 @@ module QuickParse =
QualifyingIdents = plid
}

let GetPartialLongNameEx (lineStr: string MaybeNull, index: int) : PartialLongName =
let GetPartialLongNameEx (lineStr: string | null, index: int) : PartialLongName =
match lineStr with
| Null -> PartialLongName.Empty(index)
| NonNull lineStr -> GetPartialLongNameExAux(lineStr, index)
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/Service/QuickParse.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ module public QuickParse =
/// allow us to use find the correct qualified items rather than resorting
/// to the more expensive and less accurate environment lookup.
val GetCompleteIdentifierIsland:
tolerateJustAfter: bool -> lineStr: string MaybeNull -> index: int -> (string * int * bool) option
tolerateJustAfter: bool -> lineStr: (string | null) -> index: int -> (string * int * bool) option

/// Get the partial long name of the identifier to the left of index.
val GetPartialLongName: lineStr: string MaybeNull * index: int -> string list * string
val GetPartialLongName: lineStr: (string | null) * index: int -> string list * string

/// Get the partial long name of the identifier to the left of index.
/// For example, for `System.DateTime.Now` it returns PartialLongName ([|"System"; "DateTime"|], "Now", Some 32), where "32" pos of the last dot.
val GetPartialLongNameEx: lineStr: string MaybeNull * index: int -> PartialLongName
val GetPartialLongNameEx: lineStr: (string | null) * index: int -> PartialLongName

/// Tests whether the user is typing something like "member x." or "override (*comment*) x."
val TestMemberOrOverrideDeclaration: tokens: FSharpTokenInfo[] -> bool
Loading
Loading