@@ -38,7 +38,7 @@ type AssemblyLoader =
3838 /// Get a flag indicating if an assembly is a provided assembly, plus the
3939 /// table of information recording remappings from type names in the provided assembly to type
4040 /// names in the statically linked, embedded assembly.
41- abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted < ProvidedAssembly > -> bool * ProvidedAssemblyStaticLinkingMap option
41+ abstract GetProvidedAssemblyInfo : CompilationThreadToken * range * Tainted < ProvidedAssembly MaybeNull > -> bool * ProvidedAssemblyStaticLinkingMap option
4242
4343 /// Record a root for a [<Generate>] type to help guide static linking & type relocation
4444 abstract RecordGeneratedTypeRoot : ProviderGeneratedType -> unit
@@ -183,16 +183,24 @@ let rec ImportILType (env: ImportMap) m tinst ty =
183183 ImportTyconRefApp env tcref inst
184184
185185 | ILType.Byref ty -> mkByrefTy env.g ( ImportILType env m tinst ty)
186+
186187 | ILType.Ptr ILType.Void when env.g.voidptr_ tcr.CanDeref -> mkVoidPtrTy env.g
188+
187189 | ILType.Ptr ty -> mkNativePtrTy env.g ( ImportILType env m tinst ty)
190+
188191 | ILType.FunctionPointer _ -> env.g.nativeint_ ty (* failwith "cannot import this kind of type (ptr, fptr)" *)
192+
189193 | ILType.Modified(_, _, ty) ->
190194 // All custom modifiers are ignored
191195 ImportILType env m tinst ty
196+
192197 | ILType.TypeVar u16 ->
193- try List.item ( int u16) tinst
194- with _ ->
195- error( Error( FSComp.SR.impNotEnoughTypeParamsInScopeWhileImporting(), m))
198+ let ty =
199+ try
200+ List.item ( int u16) tinst
201+ with _ ->
202+ error( Error( FSComp.SR.impNotEnoughTypeParamsInScopeWhileImporting(), m))
203+ ty
196204
197205/// Determines if an IL type can be imported as an F# type
198206let rec CanImportILType ( env : ImportMap ) m ty =
@@ -354,15 +362,15 @@ let rec ImportProvidedType (env: ImportMap) (m: range) (* (tinst: TypeInst) *) (
354362
355363/// Import a provided method reference as an Abstract IL method reference
356364let ImportProvidedMethodBaseAsILMethodRef ( env : ImportMap ) ( m : range ) ( mbase : Tainted < ProvidedMethodBase >) =
357- let tref = GetILTypeRefOfProvidedType ( mbase.PApply(( fun mbase -> mbase.DeclaringType), m), m)
365+ let tref = GetILTypeRefOfProvidedType ( mbase.PApply(( fun mbase -> nonNull < ProvidedType > mbase.DeclaringType), m), m)
358366
359367 let mbase =
360368 // Find the formal member corresponding to the called member
361369 match mbase.OfType< ProvidedMethodInfo>() with
362370 | Some minfo when
363- minfo.PUntaint(( fun minfo -> minfo.IsGenericMethod|| minfo.DeclaringType.IsGenericType), m) ->
371+ minfo.PUntaint(( fun minfo -> minfo.IsGenericMethod|| ( nonNull < ProvidedType > minfo.DeclaringType) .IsGenericType), m) ->
364372
365- let declaringType = minfo.PApply(( fun minfo -> minfo.DeclaringType), m)
373+ let declaringType = minfo.PApply(( fun minfo -> nonNull < ProvidedType > minfo.DeclaringType), m)
366374
367375 let declaringGenericTypeDefn =
368376 if declaringType.PUntaint(( fun t -> t.IsGenericType), m) then
@@ -381,8 +389,8 @@ let ImportProvidedMethodBaseAsILMethodRef (env: ImportMap) (m: range) (mbase: Ta
381389 error( Error( FSComp.SR.etIncorrectProvidedMethod( DisplayNameOfTypeProvider( minfo.TypeProvider, m), methodName, metadataToken, typeName), m))
382390 | _ ->
383391 match mbase.OfType< ProvidedConstructorInfo>() with
384- | Some cinfo when cinfo.PUntaint(( fun x -> x.DeclaringType.IsGenericType), m) ->
385- let declaringType = cinfo.PApply(( fun x -> x.DeclaringType), m)
392+ | Some cinfo when cinfo.PUntaint(( fun x -> ( nonNull < ProvidedType > x.DeclaringType) .IsGenericType), m) ->
393+ let declaringType = cinfo.PApply(( fun x -> nonNull < ProvidedType > x.DeclaringType), m)
386394 let declaringGenericTypeDefn = declaringType.PApply(( fun x -> x.GetGenericTypeDefinition()), m)
387395
388396 // We have to find the uninstantiated formal signature corresponding to this instantiated constructor.
0 commit comments