Skip to content

Commit 079bd5c

Browse files
committed
Don't forget that %a also takes 2 arguments
1 parent a35257a commit 079bd5c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/fsharp/CheckFormatStrings.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ let parseFormatStringInternal (m:range) g (source: string option) fmt bty cty =
278278
checkOtherFlags ch
279279
let xty = NewInferenceType ()
280280
let fty = bty --> (xty --> cty)
281-
collectSpecifierLocation relLine relCol 1
281+
collectSpecifierLocation relLine relCol 2
282282
parseLoop ((Option.map ((+)1) posi, xty) :: (posi, fty) :: acc) (i+1, relLine, relCol+1)
283283

284284
| 't' ->

tests/service/EditorTests.fs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ let _ = sprintf " %.*f" 3 4.5
397397
let _ = sprintf " %*.1f" 3 4.5
398398
let _ = sprintf " %6.*f" 3 4.5
399399
let _ = sprintf " %6.*%" 3
400+
let _ = sprintf " %a" (fun _ _ -> ()) 2
401+
let _ = sprintf " %*a" 3 (fun _ _ -> ()) 2
400402
"""
401403

402404
let file = "/home/user/Test.fsx"
@@ -432,7 +434,9 @@ let _ = sprintf " %6.*%" 3
432434
(29, 24, 29, 27, 2);
433435
(30, 25, 30, 29, 2);
434436
(31, 26, 31, 30, 2);
435-
(32, 27, 32, 31, 1)|]
437+
(32, 27, 32, 31, 1);
438+
(33, 28, 33, 39, 2)
439+
(34, 29, 34, 31, 3)|]
436440

437441
[<Test>]
438442
let ``Printf specifiers for triple-quote strings`` () =

0 commit comments

Comments
 (0)