Skip to content

Commit 73b0d1d

Browse files
authored
Fixed indexer with type annotation (#8850)
1 parent 85af456 commit 73b0d1d

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/fsharp/pars.fsy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3756,6 +3756,9 @@ atomicExprQualification:
37563756
mlCompatWarning (FSComp.SR.parsParenFormIsForML()) (lhs parseState)
37573757
mkSynDotParenGet lhsm dotm e $2) }
37583758

3759+
| LBRACK typedSeqExpr RBRACK
3760+
{ (fun e lhsm dotm -> mkSynDotBrackGet lhsm dotm e $2 false) }
3761+
37593762
| LBRACK typedSeqExpr recover
37603763
{ reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedBracket())
37613764
(fun e lhsm dotm -> exprFromParseError (mkSynDotBrackGet lhsm dotm e $2 false)) }
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open System
6+
open NUnit.Framework
7+
8+
[<TestFixture()>]
9+
module IndexerRegressionTests =
10+
11+
[<Test>]
12+
let ``Indexer has qualified type value``() =
13+
CompilerAssert.Pass
14+
"""
15+
let a = [| 1 |]
16+
let f y = a.[y:int]
17+
"""

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<Compile Include="Compiler\Language\SpanTests.fs" />
7272
<Compile Include="Compiler\Language\StringConcatOptimizationTests.fs" />
7373
<Compile Include="Compiler\Stress\LargeExprTests.fs" />
74+
<Compile Include="Compiler\Regressions\IndexerRegressionTests.fs" />
7475
<Compile Include="Compiler\Regressions\ForInDoMutableRegressionTest.fs" />
7576
<None Include="app.config" />
7677
<None Include="update.base.line.with.actuals.fsx" />

0 commit comments

Comments
 (0)