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

Disallow abstract member with access modifiers in sig file #17802

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Tangent-90
Copy link
Contributor

@Tangent-90 Tangent-90 commented Sep 26, 2024

Description

Disallow abstract member with access modifiers in signature files.

// in a .fsi file
type A =
    abstract internal B: int ->int
    abstract member C: int with internal get, private set

Before: All these will build successfully
After: Error FS0561: Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type.

Checklist

  • Test cases added

@Tangent-90 Tangent-90 requested a review from a team as a code owner September 26, 2024 18:09
Copy link
Contributor

github-actions bot commented Sep 26, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.200.md

@KevinRansom
Copy link
Member

@Tangent-90 -
Hey, I was wondering why would an internal abstract member not be allowed on a public type? After all the assembly where it is defined, as well as friend assemblies can still implement it?

@Tangent-90
Copy link
Contributor Author

@Tangent-90 -
Hey, I was wondering why would an internal abstract member not be allowed on a public type? After all the assembly where it is defined, as well as friend assemblies can still implement it?

Hmm... I just simply find out that abstract internal in .fs file is not allowed, and in .fsi file will take no effect.

@Tangent-90
Copy link
Contributor Author

error when running Plain_Build_MacOS/Regular rebuild of FSharp.Compiler.Service.sln

Unhandled exception. System.BadImageFormatException: Bad IL format. The format of the file '/Users/runner/work/1/s/artifacts/bin/fsyacc/Debug/net9.0/osx-x64/fsyacc.dll' is invalid.
/var/folders/t5/14gs56bj7djcylkj26c908n40000gn/T/MSBuildTemprunner/tmpb55944d209f44f83b58b156af720d99b.exec.cmd: line 2: 4313 Abort trap: 6 "/Users/runner/hostedtoolcache/dotnet/dotnet" "/Users/runner/work/1/s/artifacts//bin/fsyacc/Debug/net9.0/osx-x64/fsyacc.dll" -o "/Users/runner/work/1/s/artifacts/obj/FSharp.Compiler.Service/Debug/net9.0/ilpars.fs" --module FSharp.Compiler.AbstractIL.AsciiParser --open FSharp.Compiler.AbstractIL.AsciiConstants --open FSharp.Compiler.AbstractIL.IL --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing --buffer-type-argument char AbstractIL/ilpars.fsy
/Users/runner/work/1/s/buildtools/buildtools.targets(54,5): error MSB3073: The command ""/Users/runner/hostedtoolcache/dotnet/dotnet" "/Users/runner/work/1/s/artifacts//bin/fsyacc/Debug/net9.0/osx-x64/fsyacc.dll" -o "/Users/runner/work/1/s/artifacts/obj/FSharp.Compiler.Service/Debug/net9.0/ilpars.fs" --module FSharp.Compiler.AbstractIL.AsciiParser --open FSharp.Compiler.AbstractIL.AsciiConstants --open FSharp.Compiler.AbstractIL.IL --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing --buffer-type-argument char AbstractIL/ilpars.fsy" exited with code 134. [/Users/runner/work/1/s/src/Compiler/FSharp.Compiler.Service.fsproj::TargetFramework=net9.0]

Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

2 participants