Skip to content

Commit a19aa4a

Browse files
committed
Tests update
1 parent 41035ab commit a19aa4a

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.debug.bsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
.method public hidebysig specialname
6767
instance int32 get_hash() cil managed
6868
{
69+
.custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
6970
// Code size 7 (0x7)
7071
.maxstack 8
7172
IL_0000: ldarg.0

tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Structs02.fs.il.release.bsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
.method public hidebysig specialname
6767
instance int32 get_hash() cil managed
6868
{
69+
.custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
6970
// Code size 7 (0x7)
7071
.maxstack 8
7172
IL_0000: ldarg.0

tests/FSharp.Compiler.ComponentTests/EmittedIL/StructGettersReadOnly.fs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ module ``Struct getters readonly`` =
4949
member _.MyField = myField
5050
"""
5151

52+
let structNonRecordVal =
53+
FSharp
54+
"""
55+
module TestStructNonRecordVal
56+
57+
[<Struct>]
58+
type MyStruct =
59+
val MyField: int
60+
"""
61+
5262
let structWithCustomGetter =
5363
FSharp
5464
"""
@@ -93,13 +103,21 @@ module ``Struct getters readonly`` =
93103
|> shouldn't haveAttribute "IsReadOnlyAttribute"
94104

95105
[<Fact>]
96-
let ``Struct non-record has readonly getters`` () =
106+
let ``Struct has readonly getters`` () =
97107
structNonRecord
98108
|> compileAssembly
99109
|> getType "TestStructNonRecord+MyStruct"
100110
|> getMethod "get_MyField"
101111
|> should haveAttribute "IsReadOnlyAttribute"
102112

113+
[<Fact>]
114+
let ``Struct val has readonly getter`` () =
115+
structNonRecordVal
116+
|> compileAssembly
117+
|> getType "TestStructNonRecordVal+MyStruct"
118+
|> getMethod "get_MyField"
119+
|> should haveAttribute "IsReadOnlyAttribute"
120+
103121
[<Fact>]
104122
let ``Custom getter on a struct doesn't have readonly attribute`` () =
105123
structWithCustomGetter

tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.debug.bsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
.method public hidebysig specialname
6666
instance float64 get_F() cil managed
6767
{
68+
.custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
6869
// Code size 7 (0x7)
6970
.maxstack 8
7071
IL_0000: ldarg.0
@@ -409,6 +410,7 @@
409410
.method public hidebysig specialname
410411
instance float64 get_D() cil managed
411412
{
413+
.custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
412414
// Code size 7 (0x7)
413415
.maxstack 8
414416
IL_0000: ldarg.0

tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/FloatsAndDoubles.fs.il.release.bsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
.method public hidebysig specialname
6666
instance float64 get_F() cil managed
6767
{
68+
.custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
6869
// Code size 7 (0x7)
6970
.maxstack 8
7071
IL_0000: ldarg.0
@@ -376,6 +377,7 @@
376377
.method public hidebysig specialname
377378
instance float64 get_D() cil managed
378379
{
380+
.custom instance void [runtime]System.Runtime.CompilerServices.IsReadOnlyAttribute::.ctor() = ( 01 00 00 00 )
379381
// Code size 7 (0x7)
380382
.maxstack 8
381383
IL_0000: ldarg.0

0 commit comments

Comments
 (0)