Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
f6e856cb
F
fsharp
项目概览
dotNET Platform
/
fsharp
10 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f6e856cb
编写于
5月 04, 2022
作者:
F
Florian Verdonck
提交者:
GitHub
5月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add SynMeasure.Paren (#13058)
上级
f5e74287
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
45 addition
and
1 deletion
+45
-1
src/fsharp/CheckExpressions.fs
src/fsharp/CheckExpressions.fs
+1
-0
src/fsharp/SyntaxTree.fs
src/fsharp/SyntaxTree.fs
+2
-0
src/fsharp/SyntaxTree.fsi
src/fsharp/SyntaxTree.fsi
+3
-0
src/fsharp/pars.fsy
src/fsharp/pars.fsy
+2
-1
src/fsharp/service/ServiceParsedInputOps.fs
src/fsharp/service/ServiceParsedInputOps.fs
+1
-0
tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected
...s/FSharp.CompilerService.SurfaceArea.netstandard.expected
+9
-0
tests/service/Symbols.fs
tests/service/Symbols.fs
+27
-0
未找到文件。
src/fsharp/CheckExpressions.fs
浏览文件 @
f6e856cb
...
...
@@ -836,6 +836,7 @@ let TcConst (cenv: cenv) (overallTy: TType) m env c =
| SynMeasure.Seq(mss, _) -> ProdMeasures (List.map tcMeasure mss)
| SynMeasure.Anon _ -> error(Error(FSComp.SR.tcUnexpectedMeasureAnon(), m))
| SynMeasure.Var(_, m) -> error(Error(FSComp.SR.tcNonZeroConstantCannotHaveGenericUnit(), m))
| SynMeasure.Paren(measure, _) -> tcMeasure measure
let unif expected = UnifyTypes cenv env m overallTy expected
...
...
src/fsharp/SyntaxTree.fs
浏览文件 @
f6e856cb
...
...
@@ -173,6 +173,8 @@ type SynMeasure =
|
Anon
of
range
:
range
|
Var
of
typar
:
SynTypar
*
range
:
range
|
Paren
of
measure
:
SynMeasure
*
range
:
range
[<
NoEquality
;
NoComparison
;
RequireQualifiedAccess
>]
type
SynRationalConst
=
...
...
src/fsharp/SyntaxTree.fsi
浏览文件 @
f6e856cb
...
...
@@ -207,6 +207,9 @@ type SynMeasure =
/// A variable unit of measure
|
Var
of
typar
:
SynTypar
*
range
:
range
/// A parenthesized measure
|
Paren
of
measure
:
SynMeasure
*
range
:
range
/// Represents an unchecked syntax tree of F# unit of measure exponents.
[<
NoEquality
;
NoComparison
;
RequireQualifiedAccess
>]
type
SynRationalConst
=
...
...
src/fsharp/pars.fsy
浏览文件 @
f6e856cb
...
...
@@ -5528,7 +5528,8 @@ measureTypeAtom:
{ SynMeasure.Var($1, lhs parseState) }
| LPAREN measureTypeExpr rparen
{ $2 }
{ let mParen = rhs2 parseState 1 3
SynMeasure.Paren($2, mParen) }
measureTypePower:
| measureTypeAtom
...
...
src/fsharp/service/ServiceParsedInputOps.fs
浏览文件 @
f6e856cb
...
...
@@ -1459,6 +1459,7 @@ module ParsedInput =
|
SynMeasure
.
Divide
(
m1
,
m2
,
_)
->
walkMeasure
m1
;
walkMeasure
m2
|
SynMeasure
.
Named
(
longIdent
,
_)
->
addLongIdent
longIdent
|
SynMeasure
.
Seq
(
ms
,
_)
->
List
.
iter
walkMeasure
ms
|
SynMeasure
.
Paren
(
m
,
_)
|
SynMeasure
.
Power
(
m
,
_,
_)
->
walkMeasure
m
|
SynMeasure
.
Var
(
ty
,
_)
->
walkTypar
ty
|
SynMeasure
.
One
...
...
tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected
浏览文件 @
f6e856cb
...
...
@@ -7244,6 +7244,10 @@ FSharp.Compiler.Syntax.SynMeasure+Named: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynMeasure+Named: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynMeasure+Named: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident] get_longId()
FSharp.Compiler.Syntax.SynMeasure+Named: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident] longId
FSharp.Compiler.Syntax.SynMeasure+Paren: FSharp.Compiler.Syntax.SynMeasure get_measure()
FSharp.Compiler.Syntax.SynMeasure+Paren: FSharp.Compiler.Syntax.SynMeasure measure
FSharp.Compiler.Syntax.SynMeasure+Paren: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynMeasure+Paren: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynMeasure+Power: FSharp.Compiler.Syntax.SynMeasure get_measure()
FSharp.Compiler.Syntax.SynMeasure+Power: FSharp.Compiler.Syntax.SynMeasure measure
FSharp.Compiler.Syntax.SynMeasure+Power: FSharp.Compiler.Syntax.SynRationalConst get_power()
...
...
@@ -7264,6 +7268,7 @@ FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 Anon
FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 Divide
FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 Named
FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 One
FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 Paren
FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 Power
FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 Product
FSharp.Compiler.Syntax.SynMeasure+Tags: Int32 Seq
...
...
@@ -7276,6 +7281,7 @@ FSharp.Compiler.Syntax.SynMeasure: Boolean IsAnon
FSharp.Compiler.Syntax.SynMeasure: Boolean IsDivide
FSharp.Compiler.Syntax.SynMeasure: Boolean IsNamed
FSharp.Compiler.Syntax.SynMeasure: Boolean IsOne
FSharp.Compiler.Syntax.SynMeasure: Boolean IsParen
FSharp.Compiler.Syntax.SynMeasure: Boolean IsPower
FSharp.Compiler.Syntax.SynMeasure: Boolean IsProduct
FSharp.Compiler.Syntax.SynMeasure: Boolean IsSeq
...
...
@@ -7284,6 +7290,7 @@ FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsAnon()
FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsDivide()
FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsNamed()
FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsOne()
FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsParen()
FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsPower()
FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsProduct()
FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsSeq()
...
...
@@ -7291,6 +7298,7 @@ FSharp.Compiler.Syntax.SynMeasure: Boolean get_IsVar()
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure NewAnon(FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure NewDivide(FSharp.Compiler.Syntax.SynMeasure, FSharp.Compiler.Syntax.SynMeasure, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure NewNamed(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure NewParen(FSharp.Compiler.Syntax.SynMeasure, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure NewPower(FSharp.Compiler.Syntax.SynMeasure, FSharp.Compiler.Syntax.SynRationalConst, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure NewProduct(FSharp.Compiler.Syntax.SynMeasure, FSharp.Compiler.Syntax.SynMeasure, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure NewSeq(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMeasure], FSharp.Compiler.Text.Range)
...
...
@@ -7300,6 +7308,7 @@ FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure get_One()
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure+Anon
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure+Divide
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure+Named
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure+Paren
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure+Power
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure+Product
FSharp.Compiler.Syntax.SynMeasure: FSharp.Compiler.Syntax.SynMeasure+Seq
...
...
tests/service/Symbols.fs
浏览文件 @
f6e856cb
...
...
@@ -4454,3 +4454,30 @@ type A() =
assertRange
(
5
,
5
)
(
5
,
6
)
rpr
|
_
->
Assert
.
Fail
$
"Could not get valid AST, got {ast}"
module
Measures
=
[<
Test
>]
let
``SynMeasure.Paren has correct range``
()
=
let
parseResults
=
getParseResults
"""
40u<hr / (staff weeks)>
"""
match
parseResults
with
|
ParsedInput
.
ImplFile
(
ParsedImplFileInput
(
modules
=
[
SynModuleOrNamespace
.
SynModuleOrNamespace
(
decls
=
[
SynModuleDecl
.
Expr
(
expr
=
SynExpr
.
Const
(
SynConst
.
Measure
(
SynConst
.
UInt32
_,
_,
SynMeasure
.
Divide
(
SynMeasure
.
Seq
([
SynMeasure
.
Named
([
hrIdent
],
_)
],
_),
SynMeasure
.
Seq
([
SynMeasure
.
Paren
(
SynMeasure
.
Seq
([
SynMeasure
.
Named
([
staffIdent
],
_)
SynMeasure
.
Named
([
weeksIdent
],
_)
],
_)
,
mParen
)
],
_),
_)
),
_))
])
]))
->
Assert
.
AreEqual
(
"hr"
,
hrIdent
.
idText
)
Assert
.
AreEqual
(
"staff"
,
staffIdent
.
idText
)
Assert
.
AreEqual
(
"weeks"
,
weeksIdent
.
idText
)
assertRange
(
2
,
9
)
(
2
,
22
)
mParen
|
_
->
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录