Skip to content

Commit 7b958fd

Browse files
add a failing test exhibiting issue #8351
1 parent 16bca5a commit 7b958fd

5 files changed

Lines changed: 54 additions & 2 deletions

File tree

tests/FSharp.TestHelpers/TestFramework.fs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ module Commands =
9696
let csc exec cscExe flags srcFiles =
9797
exec cscExe (sprintf "%s %s" flags (srcFiles |> Seq.ofList |> String.concat " "))
9898

99+
let vbc exec vbcExe flags srcFiles =
100+
exec vbcExe (sprintf "%s %s" flags (srcFiles |> Seq.ofList |> String.concat " "))
101+
99102
let fsi exec fsiExe flags sources =
100103
exec fsiExe (sprintf "%s %s" flags (sources |> Seq.ofList |> String.concat " "))
101104

@@ -123,6 +126,8 @@ type TestConfig =
123126
{ EnvironmentVariables : Map<string, string>
124127
CSC : string
125128
csc_flags : string
129+
VBC : string
130+
vbc_flags : string
126131
BUILD_CONFIG : string
127132
FSC : string
128133
fsc_flags : string
@@ -183,11 +188,13 @@ let config configurationName envVars =
183188
let artifactsBinPath = artifactsPath ++ "bin"
184189
let coreClrRuntimePackageVersion = "3.0.0-preview-27318-01"
185190
let csc_flags = "/nologo"
191+
let vbc_flags = "/nologo"
186192
let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED"
187193
let fsi_flags = "-r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror"
188194
let Is64BitOperatingSystem = WindowsPlatform.Is64BitOperatingSystem envVars
189195
let architectureMoniker = if Is64BitOperatingSystem then "x64" else "x86"
190196
let CSC = requireFile (packagesDir ++ "Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe")
197+
let VBC = requireFile (packagesDir ++ "Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "vbc.exe")
191198
let ILDASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ildasm.exe")
192199
let ILASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ilasm.exe")
193200
let coreclrdll = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.Runtime.CoreCLR") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "coreclr.dll")
@@ -223,6 +230,7 @@ let config configurationName envVars =
223230
ILDASM = ILDASM
224231
ILASM = ILASM
225232
PEVERIFY = PEVERIFY
233+
VBC = VBC
226234
CSC = CSC
227235
BUILD_CONFIG = configurationName
228236
FSC = FSC
@@ -235,7 +243,8 @@ let config configurationName envVars =
235243
FSharpCompilerInteractiveSettings = FSharpCompilerInteractiveSettings
236244
csc_flags = csc_flags
237245
fsc_flags = fsc_flags
238-
fsi_flags = fsi_flags
246+
fsi_flags = fsi_flags
247+
vbc_flags = vbc_flags
239248
Directory=""
240249
DotNetExe = dotNetExe
241250
DefaultPlatform = defaultPlatform }
@@ -462,6 +471,7 @@ let fscBothToOut cfg out arg = Printf.ksprintf (Commands.fsc cfg.Directory (exec
462471
let fscBothToOutExpectFail cfg out arg = Printf.ksprintf (Commands.fsc cfg.Directory (execBothToOutExpectFail cfg cfg.Directory out) cfg.DotNetExe cfg.FSC) arg
463472
let fscAppendErrExpectFail cfg errPath arg = Printf.ksprintf (Commands.fsc cfg.Directory (execAppendErrExpectFail cfg errPath) cfg.DotNetExe cfg.FSC) arg
464473
let csc cfg arg = Printf.ksprintf (Commands.csc (exec cfg) cfg.CSC) arg
474+
let vbc cfg arg = Printf.ksprintf (Commands.vbc (exec cfg) cfg.VBC) arg
465475
let ildasm cfg arg = Printf.ksprintf (Commands.ildasm (exec cfg) cfg.ILDASM) arg
466476
let ilasm cfg arg = Printf.ksprintf (Commands.ilasm (exec cfg) cfg.ILASM) arg
467477
let peverify cfg = Commands.peverify (exec cfg) cfg.PEVERIFY "/nologo"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace csharp
2+
{
3+
public class Class
4+
{
5+
public int Prop { set; private get; }
6+
}
7+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type Class () =
2+
let mutable v = 0
3+
member x.Prop with set(value) = v <- value
4+
5+
let a = csharp.Class(Prop=1)
6+
let b = basic.BasicClass(Prop=1)
7+
let c = Class(Prop=1)
8+
9+
type Maker =
10+
static member mkCs () = csharp.Class()
11+
static member mkVb () = basic.BasicClass()
12+
static member mkFs () = Class()
13+
14+
let aa = Maker.mkCs(Prop=1)
15+
let bb = Maker.mkVb(Prop=1)
16+
let cc = Maker.mkFs(Prop=1)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace basic
2+
public class BasicClass
3+
dim v as integer
4+
public writeonly property Prop as integer
5+
set(value as integer)
6+
v = value
7+
end set
8+
end property
9+
end class
10+
end namespace

tests/fsharp/tests.fs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ module CoreTests =
288288

289289
testOkFile.CheckExists()
290290
end
291-
291+
292292
[<Test>]
293293
let span () =
294294

@@ -1813,6 +1813,15 @@ module CoreTests =
18131813
fsc cfg "%s -o:xmlverify.exe -g" cfg.fsc_flags ["xmlverify.fs"]
18141814

18151815
peverifyWithArgs cfg "/nologo" "xmlverify.exe"
1816+
1817+
1818+
[<Test>]
1819+
let ``property setter in method or constructor`` () =
1820+
let cfg = testConfig "core/members/set-only-property"
1821+
csc cfg @"%s /target:library /out:cs.dll" cfg.csc_flags ["cs.cs"]
1822+
vbc cfg @"%s /target:library /out:vb.dll" cfg.vbc_flags ["vb.vb"]
1823+
fsc cfg @"%s -r:cs.dll -r:vb.dll -o:fs.exe" cfg.fsc_flags ["fs.fs"]
1824+
18161825
#endif
18171826

18181827
module VersionTests =

0 commit comments

Comments
 (0)