dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.84k stars 776 forks source link

Anonymous interface implementation accessibility when tuple deconstruction is used. #4161

Open enricosada opened 6 years ago

enricosada commented 6 years ago

moved from https://github.com/fsharp/fsharp/issues/802 by @FrankBro

by @FrankBro :

Anonymous interface implementation accessibility when tuple deconstruction is used

Repro steps

module private PM = 
    type PT = 
        abstract A : int
    let a = { new PT with member __.A = 1 } // ok
    let b, c = // PT is less accessible than PT * PT
        { new PT with member __.A = 1 }
        , { new PT with member __.A = 1 }
/home/runner/main.fs(5,9): error FS0410: The type 'PT' is less accessible than the value, member or type 'val patternInput : PM.PT * PM.PT' it is used in

/home/runner/main.fs(5,9): error FS0410: The type 'PT' is less accessible than the value, member or type 'val patternInput : PM.PT * PM.PT' it is used in

Expected behavior

Should work just like a does.

Actual behavior

Compile error

Known workarounds

Construct the tuple after implementing the anonymous interfaces

Related information

Repro'd here: https://repl.it/repls/FavorableDarkturquoiseGordonsetter

dsyme commented 6 years ago

Agree this is a bug. The compiler generated patternInput is either internally considered public or is somehow otherwise triggering the check

edgarfgp commented 2 days ago

Reminder to self: check with —realsig+