From 97ce53436a293679b7230aa9fdae0645895633f1 Mon Sep 17 00:00:00 2001 From: nojaf Date: Wed, 12 Oct 2022 12:10:40 +0200 Subject: [PATCH] Add additional test. --- tests/service/SyntaxTreeTests/SynTypeTests.fs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/service/SyntaxTreeTests/SynTypeTests.fs b/tests/service/SyntaxTreeTests/SynTypeTests.fs index 355e0e9dda8..7f18521a995 100644 --- a/tests/service/SyntaxTreeTests/SynTypeTests.fs +++ b/tests/service/SyntaxTreeTests/SynTypeTests.fs @@ -175,3 +175,33 @@ type X = ]) ]) ])) -> assertRange (4, 9) (4, 11) mVar | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}" + +[] +let ``SynType.Or with appType on the right hand side`` () = + let parseResults = + getParseResults + """ +let inline f (x: 'T) = ((^T or int) : (static member A: int) ()) + """ + + match parseResults with + | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ + SynModuleDecl.Let(bindings = [ + SynBinding(expr = + SynExpr.Paren(expr = + SynExpr.TraitCall(supportTys = + SynType.Paren( + SynType.Or( + SynType.Var(range = mVar), + (SynType.LongIdent _ as appType), + mOrType, + { OrKeyword = mOrWord }), + mParen)) + )) + ]) ]) ])) -> + assertRange (2, 25) (2,27) mVar + assertRange (2, 28) (2, 30) mOrWord + assertRange (2, 31) (2, 34) appType.Range + assertRange (2,25) (2, 34) mOrType + assertRange (2,24) (2, 35) mParen + | _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"