Skip to content

Commit 01fd7cc

Browse files
committed
Remove calls to TypeInfo.AsType().
This includes the file `coreclr_utilities.fs` file, which does not seem to be needed since .NET Core 2.0.
1 parent 457b463 commit 01fd7cc

File tree

4 files changed

+9
-173
lines changed

4 files changed

+9
-173
lines changed

src/Compiler/AbstractIL/ilreflect.fs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ type TypeBuilder with
163163
if logRefEmitCalls then
164164
printfn "typeBuilder%d.CreateType()" (abs <| hash typB)
165165

166-
typB.CreateTypeInfo().AsType()
166+
typB.CreateTypeInfo() :> Type
167167

168168
member typB.DefineNestedTypeAndLog(name, attrs) =
169169
let res = typB.DefineNestedType(name, attrs)
@@ -1902,7 +1902,7 @@ let rec buildMethodPass2 cenv tref (typB: TypeBuilder) emEnv (mdef: ILMethodDef)
19021902
let genArgs = getGenericArgumentsOfMethod methB
19031903

19041904
let emEnv =
1905-
envPushTyvars emEnv (Array.append (getGenericArgumentsOfType (typB.AsType())) genArgs)
1905+
envPushTyvars emEnv (Array.append (getGenericArgumentsOfType typB) genArgs)
19061906

19071907
buildGenParamsPass1b cenv emEnv genArgs mdef.GenericParams
19081908

@@ -1965,7 +1965,7 @@ let rec buildMethodPass3 cenv tref modB (typB: TypeBuilder) emEnv (mdef: ILMetho
19651965
let methB = envGetMethB emEnv mref
19661966

19671967
let emEnv =
1968-
envPushTyvars emEnv (Array.append (getGenericArgumentsOfType (typB.AsType())) (getGenericArgumentsOfMethod methB))
1968+
envPushTyvars emEnv (Array.append (getGenericArgumentsOfType typB) (getGenericArgumentsOfMethod methB))
19691969

19701970
if not (Array.isEmpty (mdef.Return.CustomAttrs.AsArray())) then
19711971
let retB = methB.DefineParameterAndLog(0, ParameterAttributes.Retval, null)
@@ -2091,8 +2091,7 @@ let buildEventPass3 cenv (typB: TypeBuilder) emEnv (eventDef: ILEventDef) =
20912091
//----------------------------------------------------------------------------
20922092

20932093
let buildMethodImplsPass3 cenv _tref (typB: TypeBuilder) emEnv (mimpl: ILMethodImplDef) =
2094-
let bodyMethInfo =
2095-
convMethodRef cenv emEnv (typB.AsType()) mimpl.OverrideBy.MethodRef // doc: must be MethodBuilder
2094+
let bodyMethInfo = convMethodRef cenv emEnv typB mimpl.OverrideBy.MethodRef // doc: must be MethodBuilder
20962095

20972096
let (OverridesSpec (mref, dtyp)) = mimpl.Overrides
20982097
let declMethTI = convType cenv emEnv dtyp
@@ -2213,7 +2212,7 @@ and buildTypeTypeDef cenv emEnv modB (typB: TypeBuilder) nesting tdef =
22132212
let rec buildTypeDefPass1b cenv nesting emEnv (tdef: ILTypeDef) =
22142213
let tref = mkRefForNestedILTypeDef ILScopeRef.Local (nesting, tdef)
22152214
let typB = envGetTypB emEnv tref
2216-
let genArgs = getGenericArgumentsOfType (typB.AsType())
2215+
let genArgs = getGenericArgumentsOfType typB
22172216
let emEnv = envPushTyvars emEnv genArgs
22182217
// Parent may reference types being defined, so has to come after it's Pass1 creation
22192218
tdef.Extends
@@ -2232,7 +2231,7 @@ let rec buildTypeDefPass1b cenv nesting emEnv (tdef: ILTypeDef) =
22322231
let rec buildTypeDefPass2 cenv nesting emEnv (tdef: ILTypeDef) =
22332232
let tref = mkRefForNestedILTypeDef ILScopeRef.Local (nesting, tdef)
22342233
let typB = envGetTypB emEnv tref
2235-
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType (typB.AsType()))
2234+
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType typB)
22362235
// add interface impls
22372236
tdef.Implements
22382237
|> convTypes cenv emEnv
@@ -2262,7 +2261,7 @@ let rec buildTypeDefPass2 cenv nesting emEnv (tdef: ILTypeDef) =
22622261
let rec buildTypeDefPass3 cenv nesting modB emEnv (tdef: ILTypeDef) =
22632262
let tref = mkRefForNestedILTypeDef ILScopeRef.Local (nesting, tdef)
22642263
let typB = envGetTypB emEnv tref
2265-
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType (typB.AsType()))
2264+
let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType typB)
22662265
// add method bodies, properties, events
22672266
tdef.Methods |> Seq.iter (buildMethodPass3 cenv tref modB typB emEnv)
22682267
tdef.Properties.AsList() |> List.iter (buildPropertyPass3 cenv tref typB emEnv)

tests/fsharp/coreclr_utilities.fs

Lines changed: 0 additions & 163 deletions
This file was deleted.

tests/fsharp/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The tests are NUNIT test cases. They test a very wide range of compiler, interac
66

77
The bulk of the test cases are enumerated in tests.fs, these are the old cambridge test suite. They build on a test-suite ported from windows batch files. They run the compiler and fsi as seperate processes, when built for the coreclr it runs the coreclr versions using dotnet.exe
88

9-
The framework and utilities can be found in test-framework.fs, single-test.fs, coreclr_utilities.fs.
9+
The framework and utilities can be found in test-framework.fs, single-test.fs.
1010

1111
test cases look similar to:
1212
````

tests/fsharp/single-test.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion =
213213
let loadSources = []
214214
let useSources = []
215215
let extraSources = ["testlib.fsi";"testlib.fs";"test.mli";"test.ml";"test.fsi";"test.fs";"test2.fsi";"test2.fs";"test.fsx";"test2.fsx"]
216-
let utilitySources = [__SOURCE_DIRECTORY__ ++ "coreclr_utilities.fs"]
216+
let utilitySources = []
217217
let referenceItems = if String.IsNullOrEmpty(copyFiles) then [] else [copyFiles]
218218
let framework = "net6.0"
219219

0 commit comments

Comments
 (0)