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
8 changes: 4 additions & 4 deletions src/Compiler/AbstractIL/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,11 @@ type ILAssemblyRef(data) =
override x.GetHashCode() = uniqueStamp

override x.Equals yobj =
((yobj :?> ILAssemblyRef).UniqueStamp = uniqueStamp)
((!!yobj :?> ILAssemblyRef).UniqueStamp = uniqueStamp)

interface IComparable with
override x.CompareTo yobj =
compare (yobj :?> ILAssemblyRef).UniqueStamp uniqueStamp
compare (!!yobj :?> ILAssemblyRef).UniqueStamp uniqueStamp

static member Create(name, hash, publicKey, retargetable, version, locale) =
ILAssemblyRef
Expand Down Expand Up @@ -750,7 +750,7 @@ type ILTypeRef =
override x.GetHashCode() = x.hashCode

override x.Equals yobj =
let y = (yobj :?> ILTypeRef)
let y = (!!yobj :?> ILTypeRef)

(x.ApproxId = y.ApproxId)
&& (x.Scope = y.Scope)
Expand Down Expand Up @@ -793,7 +793,7 @@ type ILTypeRef =
interface IComparable with

override x.CompareTo yobj =
let y = (yobj :?> ILTypeRef)
let y = (!!yobj :?> ILTypeRef)
let c = compare x.ApproxId y.ApproxId

if c <> 0 then
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/AbstractIL/ilreflect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ let rec buildMethodPass2 cenv tref (typB: TypeBuilder) emEnv (mdef: ILMethodDef)
let methB =
System.Diagnostics.Debug.Assert(not (isNull definePInvokeMethod), "Runtime does not have DefinePInvokeMethod") // Absolutely can't happen

(!!definePInvokeMethod)
!!(!!definePInvokeMethod)
.Invoke(
typB,
[|
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Checking/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ module ProvidedMethodCalls =
| _ when typeEquiv g normTy g.float32_ty -> Const.Single(v :?> float32)
| _ when typeEquiv g normTy g.float_ty -> Const.Double(v :?> float)
| _ when typeEquiv g normTy g.char_ty -> Const.Char(v :?> char)
| _ when typeEquiv g normTy g.string_ty -> Const.String(v :?> string)
| _ when typeEquiv g normTy g.string_ty -> Const.String(!!v :?> string)
| _ when typeEquiv g normTy g.decimal_ty -> Const.Decimal(v :?> decimal)
| _ when typeEquiv g normTy g.unit_ty -> Const.Unit
| _ -> fail()
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/DependencyManager/AssemblyResolveHandler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type AssemblyResolveHandlerCoreclr(assemblyProbingPaths: AssemblyResolutionProbe

member _.ResolveAssemblyNetStandard (ctxt: 'T) (assemblyName: AssemblyName) : Assembly =
let loadAssembly path =
loadFromAssemblyPathMethod.Invoke(ctxt, [| path |]) :?> Assembly
!! loadFromAssemblyPathMethod.Invoke(ctxt, [| path |]) :?> Assembly

let assemblyPaths =
match assemblyProbingPaths with
Expand Down
16 changes: 8 additions & 8 deletions src/Compiler/DependencyManager/DependencyProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ type ReflectionDependencyManagerProvider
let keyProperty (x: objnull) = x |> keyProperty.GetValue |> string

let helpMessagesProperty (x: objnull) =
let toStringArray (o: objnull) = o :?> string[]
let toStringArray (o: objnull) = !!o :?> string[]

match helpMessagesProperty with
| Some helpMessagesProperty -> x |> helpMessagesProperty.GetValue |> toStringArray
Expand Down Expand Up @@ -334,31 +334,31 @@ type ReflectionDependencyManagerProvider
member _.StdOut =
match getInstanceProperty<string[]> (result.GetType()) "StdOut" with
| None -> [||]
| Some p -> p.GetValue(result) :?> string[]
| Some p -> !! p.GetValue(result) :?> string[]

/// The resolution error log (* process stderror *)
member _.StdError =
match getInstanceProperty<string[]> (result.GetType()) "StdError" with
| None -> [||]
| Some p -> p.GetValue(result) :?> string[]
| Some p -> !! p.GetValue(result) :?> string[]

/// The resolution paths
member _.Resolutions =
match getInstanceProperty<seq<string>> (result.GetType()) "Resolutions" with
| None -> Seq.empty<string>
| Some p -> p.GetValue(result) :?> seq<string>
| Some p -> !! p.GetValue(result) :?> seq<string>

/// The source code file paths
member _.SourceFiles =
match getInstanceProperty<seq<string>> (result.GetType()) "SourceFiles" with
| None -> Seq.empty<string>
| Some p -> p.GetValue(result) :?> seq<string>
| Some p -> !! p.GetValue(result) :?> seq<string>

/// The roots to package directories
member _.Roots =
match getInstanceProperty<seq<string>> (result.GetType()) "Roots" with
| None -> Seq.empty<string>
| Some p -> p.GetValue(result) :?> seq<string>
| Some p -> !! p.GetValue(result) :?> seq<string>
}

static member MakeResultFromFields
Expand Down Expand Up @@ -473,8 +473,8 @@ type ReflectionDependencyManagerProvider
match tupleFields |> Array.length with
| 3 ->
tupleFields[0] :?> bool,
tupleFields[1] :?> string list |> List.toSeq,
tupleFields[2] :?> string list |> List.distinct |> List.toSeq
!!tupleFields[1] :?> string list |> List.toSeq,
!!tupleFields[2] :?> string list |> List.distinct |> List.toSeq
| _ -> false, seqEmpty, seqEmpty

ReflectionDependencyManagerProvider.MakeResultFromFields(success, [||], [||], Seq.empty, sourceFiles, packageRoots)
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/Interactive/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module internal Utilities =
}
else
let specialized = typedefof<AnyToLayoutSpecialization<_>>.MakeGenericType [| ty |]
Activator.CreateInstance(specialized) :?> IAnyToLayoutCall
!!Activator.CreateInstance(specialized) :?> IAnyToLayoutCall

let callStaticMethod (ty: Type) name args =
ty.InvokeMember(
Expand Down Expand Up @@ -4762,7 +4762,7 @@ type FsiEvaluationSession
let makeNestedException (userExn: #Exception) =
// clone userExn -- make userExn the inner exception, to retain the stacktrace on raise
let arguments = [| userExn.Message :> obj; userExn :> obj |]
Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception
!!Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception

let commitResult res =
match res with
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/TypedTree/TypeProviders.fs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ let CreateTypeProvider (
IsHostedExecution= isInteractive,
SystemRuntimeAssemblyVersion = systemRuntimeAssemblyVersion)
#endif
protect (fun () -> Activator.CreateInstance(typeProviderImplementationType, [| box e|]) :?> ITypeProvider )
protect (fun () -> !!(Activator.CreateInstance(typeProviderImplementationType, [| box e|])) :?> ITypeProvider )

elif not(isNull(typeProviderImplementationType.GetConstructor [| |])) then
protect (fun () -> Activator.CreateInstance typeProviderImplementationType :?> ITypeProvider )
protect (fun () -> !!(Activator.CreateInstance typeProviderImplementationType) :?> ITypeProvider )

else
// No appropriate constructor found
Expand Down Expand Up @@ -739,7 +739,7 @@ type ProvidedMethodBase (x: MethodBase, ctxt) =
let paramsAsObj =
try (!!meth).Invoke(provider, bindingFlags ||| BindingFlags.InvokeMethod, null, [| box x |], null)
with err -> raise (StripException (StripException err))
paramsAsObj :?> ParameterInfo[]
!!paramsAsObj :?> ParameterInfo[]

staticParams |> ProvidedParameterInfo.CreateArrayNonNull ctxt

Expand Down
8 changes: 4 additions & 4 deletions src/Compiler/Utilities/TaggedCollections.fs
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ type internal Set<'T, 'ComparerTag> when 'ComparerTag :> IComparer<'T>(comparer:
interface System.IComparable with
// Cast s2 to the exact same type as s1, see 4884.
// It is not OK to cast s2 to seq<'T>, since different compares could permute the elements.
member s1.CompareTo(s2: obj) =
SetTree.compare s1.Comparer s1.Tree (s2 :?> Set<'T, 'ComparerTag>).Tree
member s1.CompareTo(s2: objnull) =
SetTree.compare s1.Comparer s1.Tree (!!s2 :?> Set<'T, 'ComparerTag>).Tree

member this.ComputeHashCode() =
let combineHash x y = (x <<< 1) + y + 631
Expand Down Expand Up @@ -1239,7 +1239,7 @@ type internal Map<'Key, 'T, 'ComparerTag> when 'ComparerTag :> IComparer<'Key>(c
| _ -> false

interface System.IComparable with
member m1.CompareTo(m2: obj) =
member m1.CompareTo(m2: objnull) =
Seq.compareWith
(fun (kvp1: KeyValuePair<_, _>) (kvp2: KeyValuePair<_, _>) ->
let c = m1.Comparer.Compare(kvp1.Key, kvp2.Key) in
Expand All @@ -1251,7 +1251,7 @@ type internal Map<'Key, 'T, 'ComparerTag> when 'ComparerTag :> IComparer<'Key>(c
// Cast m2 to the exact same type as m1, see 4884.
// It is not OK to cast m2 to seq<KeyValuePair<'Key,'T>>, since different compares could permute the KVPs.
m1
(m2 :?> Map<'Key, 'T, 'ComparerTag>)
(!!m2 :?> Map<'Key, 'T, 'ComparerTag>)

member this.ComputeHashCode() =
let combineHash x y = (x <<< 1) + y + 631
Expand Down