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

Metadata reader: lazy base type calculation #765

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
@@ -184,13 +184,12 @@
let mkDummyTypeDef (name: string) =
let attributes = enum 0
let layout = ILTypeDefLayout.Auto
let implements = emptyILInterfaceImpls
let genericParams = []
let extends = None
let nestedTypes = emptyILTypeDefs

ILTypeDef(name, attributes, layout, emptyILInterfaceImpls, genericParams, extends, emptyILMethods, nestedTypes,
emptyILFields, emptyILMethodImpls, emptyILEvents, emptyILProperties, ILTypeDefAdditionalFlags.None,
ILTypeDef(name, attributes, layout, [], genericParams, None, emptyILMethods, nestedTypes,

Check failure on line 191 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

The object constructor 'ILTypeDef' takes 15 argument(s) but is here given 14. The required signature is 'new: name: string * attributes: TypeAttributes * layout: ILTypeDefLayout * implements: InterruptibleLazy<InterfaceImpl list> * genericParams: ILGenericParameterDefs * extends: ILType option * methods: ILMethodDefs * nestedTypes: ILTypeDefs * fields: ILFieldDefs * methodImpls: ILMethodImplDefs * events: ILEventDefs * properties: ILPropertyDefs * additionalFlags: ILTypeDefAdditionalFlags * securityDecls: ILSecurityDecls * customAttrs: ILAttributesStored -> ILTypeDef'.
emptyILFields, emptyILMethodImpls, emptyILEvents, emptyILProperties,
emptyILSecurityDecls, emptyILCustomAttrsStored)

let mkTypeAccessRights (typeElement: ITypeElement): TypeAttributes =
@@ -1166,8 +1165,9 @@
let typeDef = fcsTypeDef.TypeDef

let extends = mkTypeDefExtends typeElement
extends = typeDef.Extends &&
typeDef.Extends.IsValueCreated &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that if the value isn't created then the type is not up to date? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, looks like a bug :(

extends = typeDef.Extends.Value &&

Check failure on line 1169 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

The type 'Option<_>' does not define the field, constructor or member 'IsValueCreated'.

Check failure on line 1170 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

Type constraint mismatch. The type � 'ILType' �is not compatible with type� 'ILType option'
isUpToDateInterfaceImpls typeElement typeDef &&

isUpToDateTypeParamDefs typeElement.TypeParameters typeDef.GenericParams &&
@@ -1274,7 +1274,7 @@
| typeElement ->
let name = mkTypeDefName typeElement clrTypeName
let typeAttributes = mkTypeAttributes typeElement
let extends = mkTypeDefExtends typeElement
let extends = InterruptibleLazy (fun _ -> usingTypeElement clrTypeName None mkTypeDefExtends)
let genericParams = mkGenericParamDefs typeElement

// todo: pass this table in nested types too?
@@ -1291,14 +1291,22 @@
usingTypeElement clrTypeName [||] mkTypeDefCustomAttrs
)

let typeKind =
match typeElement with
| :? IEnum -> ILTypeDefAdditionalFlags.Enum
| :? IStruct -> ILTypeDefAdditionalFlags.ValueType

Check failure on line 1297 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

The type 'ILTypeDefAdditionalFlags' does not define the field, constructor or member 'Enum'.
| :? IDelegate -> ILTypeDefAdditionalFlags.Delegate

Check failure on line 1298 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

The type 'ILTypeDefAdditionalFlags' does not define the field, constructor or member 'ValueType'.
| :? IInterface -> ILTypeDefAdditionalFlags.Interface

Check failure on line 1299 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

The type 'ILTypeDefAdditionalFlags' does not define the field, constructor or member 'Delegate'.
| _ -> ILTypeDefAdditionalFlags.Class

Check failure on line 1300 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

The type 'ILTypeDefAdditionalFlags' does not define the field, constructor or member 'Interface'.

Check failure on line 1301 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

The type 'ILTypeDefAdditionalFlags' does not define the field, constructor or member 'Class'.
let additionalFlags =
if hasExtensions then ILTypeDefAdditionalFlags.CanContainExtensionMethods
else ILTypeDefAdditionalFlags.None
if hasExtensions then ILTypeDefAdditionalFlags.CanContainExtensionMethods ||| typeKind
else typeKind

let typeDef =
ILTypeDef(name, typeAttributes, ILTypeDefLayout.Auto, implements,
genericParams, extends, methods, nestedTypes, fields, emptyILMethodImpls, events, properties,
additionalFlags, emptyILSecurityDecls, customAttrs)

Check failure on line 1309 in ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

GitHub Actions / test-backend (windows-latest)

This expression was expected to have type� 'ILType option' �but here has type� 'InterruptibleLazy<ILType option>'

let fcsTypeDef =
{ TypeDef = typeDef
Loading