You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/release-notes/.FSharp.Compiler.Service/8.0.300.md
+1
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@
27
27
* Enforce AttributeTargets on enums ([PR #16887](https://github.com/dotnet/fsharp/pull/16887))
28
28
* Completion: fix for unfinished record field decl ([PR #16893](https://github.com/dotnet/fsharp/pull/16893))
29
29
* Enforce AttributeTargets on delegates ([PR #16891](https://github.com/dotnet/fsharp/pull/16891))
30
+
* Obsolete attribute is ignored in constructor property assignment ([PR #16900](https://github.com/dotnet/fsharp/pull/16900))
30
31
* Completion: fix completion in empty dot lambda prefix ([#16829](https://github.com/dotnet/fsharp/pull/16829))
31
32
* Fix StackOverflow when checking non-recursive bindings in module or namespace in `fscAnyCpu`/`fsiAnyCpu`. ([PR #16908](https://github.com/dotnet/fsharp/pull/16908))
Copy file name to clipboardExpand all lines: tests/FSharp.Compiler.ComponentTests/Language/ObsoleteAttributeCheckingTests.fs
+183
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
namespaceLanguage
2
2
3
+
openFSharp.Test
3
4
openXunit
4
5
openFSharp.Test.Compiler
5
6
@@ -1262,3 +1263,185 @@ let f (x: IFirst) = x.F()
1262
1263
(Error 101, Line 13, Col 11, Line 13, Col 17,"This construct is deprecated. Use G instead")
1263
1264
(Error 72, Line 13, Col 21, Line 13, Col 24,"Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.")
1264
1265
]
1266
+
1267
+
[<Fact>]
1268
+
let``Obsolete attribute warning is taken into account in a constructor property assignment`` ()=
1269
+
Fsx """
1270
+
open System
1271
+
type JsonSerializerOptions() =
1272
+
[<Obsolete("This is bad")>]
1273
+
member val DefaultOptions = false with get, set
1274
+
1275
+
member val UseCustomOptions = false with get, set
1276
+
1277
+
let options = JsonSerializerOptions(DefaultOptions = true, UseCustomOptions = false)
1278
+
let options2 = JsonSerializerOptions(DefaultOptions = true, DefaultOptions = false)
1279
+
"""
1280
+
|> typecheck
1281
+
|> shouldFail
1282
+
|> withDiagnostics [
1283
+
(Warning 44, Line 9, Col 37, Line 9, Col 51,"This construct is deprecated. This is bad")
1284
+
(Error 364, Line 10, Col 16, Line 10, Col 84,"The named argument 'DefaultOptions' has been assigned more than one value")
1285
+
(Warning 44, Line 10, Col 38, Line 10, Col 52,"This construct is deprecated. This is bad")
1286
+
(Warning 44, Line 10, Col 61, Line 10, Col 75,"This construct is deprecated. This is bad")
1287
+
]
1288
+
1289
+
[<Fact>]
1290
+
let``Obsolete attribute warning is not taken into account in prop setters that can be included in methods which are not constructors`` ()=
1291
+
Fsx """
1292
+
open System
1293
+
1294
+
type JsonSerializerOptions() =
1295
+
[<Obsolete("This is bad")>]
1296
+
member val DefaultOptions = false with get, set
1297
+
member val UseCustomOptions = false with get, set
1298
+
member this.With() = this
1299
+
1300
+
let options = JsonSerializerOptions()
1301
+
let options2 =
1302
+
options
1303
+
.With(DefaultOptions = true)
1304
+
.With(UseCustomOptions = false)
1305
+
"""
1306
+
|> typecheck
1307
+
|> withDiagnostics [
1308
+
(Warning 44, Line 13, Col 15, Line 13, Col 29,"This construct is deprecated. This is bad")
1309
+
]
1310
+
1311
+
[<Fact>]
1312
+
let``Obsolete attribute error is not taken into account in prop setters that can be included in methods which are not constructors`` ()=
1313
+
Fsx """
1314
+
open System
1315
+
1316
+
type JsonSerializerOptions() =
1317
+
[<Obsolete("This is bad", true)>]
1318
+
member val DefaultOptions = false with get, set
1319
+
member val UseCustomOptions = false with get, set
1320
+
member this.With() = this
1321
+
1322
+
let options = JsonSerializerOptions()
1323
+
let options2 =
1324
+
options
1325
+
.With(DefaultOptions = true)
1326
+
.With(UseCustomOptions = false)
1327
+
"""
1328
+
|> typecheck
1329
+
|> shouldFail
1330
+
|> withDiagnostics [
1331
+
(Error 101, Line 13, Col 15, Line 13, Col 29,"This construct is deprecated. This is bad")
1332
+
]
1333
+
1334
+
[<Fact>]
1335
+
let``Obsolete attribute error is taken into account in a constructor property assignment`` ()=
1336
+
Fsx """
1337
+
open System
1338
+
type JsonSerializerOptions() =
1339
+
[<Obsolete("This is bad", true)>]
1340
+
member val DefaultOptions = false with get, set
1341
+
1342
+
member val UseCustomOptions = false with get, set
1343
+
1344
+
let options = JsonSerializerOptions(DefaultOptions = true, UseCustomOptions = false)
1345
+
let options2 = JsonSerializerOptions(DefaultOptions = true, DefaultOptions = false)
1346
+
"""
1347
+
|> typecheck
1348
+
|> shouldFail
1349
+
|> withDiagnostics [
1350
+
(Error 101, Line 9, Col 37, Line 9, Col 51,"This construct is deprecated. This is bad");
1351
+
(Error 364, Line 10, Col 16, Line 10, Col 84,"The named argument 'DefaultOptions' has been assigned more than one value");
1352
+
(Error 101, Line 10, Col 38, Line 10, Col 52,"This construct is deprecated. This is bad")
1353
+
]
1354
+
1355
+
[<Fact>]
1356
+
let``Obsolete attribute warning is taken into account in a nested constructor property assignment`` ()=
1357
+
Fsx """
1358
+
open System
1359
+
type JsonSerializer1Options() =
1360
+
[<Obsolete("This is bad")>]
1361
+
member val DefaultOptions = false with get, set
1362
+
1363
+
member val UseCustomOptions = false with get, set
1364
+
1365
+
type JsonSerializerOptions() =
1366
+
member val DefaultOptions = JsonSerializer1Options() with get, set
0 commit comments