未验证 提交 f8b56cb6 编写于 作者: F Florian Verdonck 提交者: GitHub

Include star in topTupleType rule. (#13621)

上级 1aefc2f5
......@@ -5030,7 +5030,8 @@ topType:
topTupleType:
| topAppType STAR topTupleTypeElements
{ let t, argInfo = $1
let path = SynTupleTypeSegment.Type t :: (List.map fst $3)
let mStar = rhs parseState 2
let path = SynTupleTypeSegment.Type t :: SynTupleTypeSegment.Star mStar :: (List.map fst $3)
let mdata = argInfo :: (List.choose snd $3)
mkSynTypeTuple false path, mdata }
......
......@@ -366,3 +366,35 @@ let a =
]) ])) ->
assertRange (3, 4) (3, 7) mLet
| _ -> Assert.Fail "Could not get valid AST"
[<Test>]
let ``Tuple return type of binding should contain stars`` () =
let parseResults =
getParseResults """
let a : int * string = failwith "todo"
let b : int * string * bool = 1, "", false
"""
match parseResults with
| ParsedInput.ImplFile (ParsedImplFileInput (modules = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [
SynModuleDecl.Let(bindings = [
SynBinding(returnInfo =
Some (SynBindingReturnInfo(typeName = SynType.Tuple(path = [
SynTupleTypeSegment.Type _
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type _
]))))
])
SynModuleDecl.Let(bindings = [
SynBinding(returnInfo =
Some (SynBindingReturnInfo(typeName = SynType.Tuple(path = [
SynTupleTypeSegment.Type _
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type _
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type _
]))))
])
]) ])) ->
Assert.Pass ()
| _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册