Skip to content

Correctness bugs identified by GPT-5 #122

@Smaug123

Description

@Smaug123

(This is a super low-effort post from me. I'm a maintainer, so it's fine.)

Review performed on be86609
I haven't checked all of these reports are correct.

DocCoverage.fs: isPublic

  • The cast will fail in the MemberTypes.Constructor case, because ConstructorInfo is not MethodInfo. (I've confirmed that no tests currently hit that branch, but not verified the assertion.)
  • The Property branch only checks GetMethod and doesn't null-check; check both GetMethod and SetMethod, and include null checks
  • The Event branch only checks AddMethod; also check RemoveMethod
  • The TypeInfo/NestedType branch uses IsPublic for nested types. For nested types, IsPublic is false, and you must instead use IsNestedPublic. (Or, better, use cast to Type and use Type.IsVisible.)

ApiSurface.fs

frameworkBaselineFile uses the wrong regex group: frameworkNumber.Groups.[0].Value should be .[1].Value to get just the digits.

ApiMember.fs

In the Field case, we re-fetch the field with GetField, and then call GetValue null. Without BindingFlags, we'll only see public fields, so will omit non-public literal fields, whereupon the null.GetValue will throw. Simply reuse the fieldInfo that's in scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions