Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
496c70d0
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
496c70d0
编写于
10月 02, 2018
作者:
S
Steffen Forkmann
提交者:
Kevin Ransom (msft)
10月 02, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove second internal ValueOption (#5717)
* Remove second internal ValueOption * Update FSharp.Core in FCS * Cleanup
上级
acbca82a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
21 addition
and
27 deletion
+21
-27
src/absil/illib.fs
src/absil/illib.fs
+2
-8
src/fsharp/NameResolution.fs
src/fsharp/NameResolution.fs
+1
-1
src/fsharp/Optimizer.fs
src/fsharp/Optimizer.fs
+1
-1
src/fsharp/QuotationTranslator.fs
src/fsharp/QuotationTranslator.fs
+1
-1
src/fsharp/symbols/Symbols.fs
src/fsharp/symbols/Symbols.fs
+8
-8
src/fsharp/tast.fs
src/fsharp/tast.fs
+8
-8
未找到文件。
src/absil/illib.fs
浏览文件 @
496c70d0
...
...
@@ -432,18 +432,12 @@ module List =
let
existsSquared
f
xss
=
xss
|>
List
.
exists
(
fun
xs
->
xs
|>
List
.
exists
(
fun
x
->
f
x
))
let
mapiFoldSquared
f
z
xss
=
mapFoldSquared
f
z
(
xss
|>
mapiSquared
(
fun
i
j
x
->
(
i
,
j
,
x
)))
[<
Struct
>]
type
ValueOption
<
'
T
>
=
|
ValueSome
of
'
T
|
ValueNone
member
x
.
IsSome
=
match
x
with
ValueSome
_
->
true
|
ValueNone
->
false
member
x
.
IsNone
=
match
x
with
ValueSome
_
->
false
|
ValueNone
->
true
member
x
.
Value
=
match
x
with
ValueSome
r
->
r
|
ValueNone
->
failwith
"ValueOption.Value: value is None"
[<
CompilationRepresentation
(
CompilationRepresentationFlags
.
ModuleSuffix
)>]
module
ValueOption
=
let
inline
ofOption
x
=
match
x
with
Some
x
->
ValueSome
x
|
None
->
ValueNone
let
inline
bind
f
x
=
match
x
with
ValueSome
x
->
f
x
|
ValueNone
->
ValueNone
let
inline
isSome
x
=
match
x
with
ValueSome
_
->
true
|
ValueNone
->
false
let
inline
isNone
x
=
match
x
with
ValueSome
_
->
false
|
ValueNone
->
true
type
String
with
member
inline
x
.
StartsWithOrdinal
(
value
)
=
...
...
src/fsharp/NameResolution.fs
浏览文件 @
496c70d0
...
...
@@ -1097,7 +1097,7 @@ let AddEntityForProvidedType (amap: Import.ImportMap, modref: ModuleOrNamespaceR
let
tycon
=
Construct
.
NewProvidedTycon
(
resolutionEnvironment
,
st
,
importProvidedType
,
isSuppressRelocate
,
m
)
modref
.
ModuleOrNamespaceType
.
AddProvidedTypeEntity
(
tycon
)
let
tcref
=
modref
.
NestedTyconRef
tycon
System
.
Diagnostics
.
Debug
.
Assert
modref
.
TryDeref
.
IsSome
System
.
Diagnostics
.
Debug
.
Assert
(
ValueOption
.
isSome
modref
.
TryDeref
)
tcref
...
...
src/fsharp/Optimizer.fs
浏览文件 @
496c70d0
...
...
@@ -3090,7 +3090,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
|
None
->
false
|
Some
mbrTyconRef
->
// Check we can deref system_MarshalByRefObject_tcref. When compiling against the Silverlight mscorlib we can't
if
mbrTyconRef
.
TryDeref
.
IsSome
then
if
ValueOption
.
isSome
mbrTyconRef
.
TryDeref
then
// Check if this is a subtype of MarshalByRefObject
assert
(
cenv
.
g
.
system_MarshalByRefObject_ty
.
IsSome
)
ExistsSameHeadTypeInHierarchy
cenv
.
g
cenv
.
amap
vref
.
Range
(
generalizedTyconRef
tcref
)
cenv
.
g
.
system_MarshalByRefObject_ty
.
Value
...
...
src/fsharp/QuotationTranslator.fs
浏览文件 @
496c70d0
...
...
@@ -66,7 +66,7 @@ type QuotationGenerationScope =
static
member
ComputeQuotationFormat
g
=
let
deserializeExValRef
=
ValRefForIntrinsic
g
.
deserialize_quoted_FSharp_40_plus_info
if
deserializeExValRef
.
TryDeref
.
IsSome
then
if
ValueOption
.
isSome
deserializeExValRef
.
TryDeref
then
QuotationSerializationFormat
.
FSharp_40_Plus
else
QuotationSerializationFormat
.
FSharp_20_Plus
...
...
src/fsharp/symbols/Symbols.fs
浏览文件 @
496c70d0
...
...
@@ -86,7 +86,7 @@ module Impl =
let
entityIsUnresolved
(
entity
:
EntityRef
)
=
match
entity
with
|
ERefNonLocal
(
NonLocalEntityRef
(
ccu
,
_))
->
ccu
.
IsUnresolvedReference
&&
entity
.
TryDeref
.
IsNone
ccu
.
IsUnresolvedReference
&&
ValueOption
.
isNone
entity
.
TryDeref
|
_
->
false
let
checkEntityIsResolved
(
entity
:
EntityRef
)
=
...
...
@@ -754,10 +754,10 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) =
let
isUnresolved
()
=
entityIsUnresolved
v
.
TyconRef
||
v
.
TryUnionCase
.
IsNon
e
entityIsUnresolved
v
.
TyconRef
||
ValueOption
.
isNone
v
.
TryUnionCas
e
let
checkIsResolved
()
=
checkEntityIsResolved
v
.
TyconRef
if
v
.
TryUnionCase
.
IsNon
e
then
if
ValueOption
.
isNone
v
.
TryUnionCas
e
then
invalidOp
(
sprintf
"The union case '%s' could not be found in the target type"
v
.
CaseName
)
member
__.
IsUnresolved
=
...
...
@@ -854,18 +854,18 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) =
let
isUnresolved
()
=
entityIsUnresolved
d
.
DeclaringTyconRef
||
match
d
with
|
RecdOrClass
v
->
v
.
TryRecdField
.
IsNone
|
Union
(
v
,
_)
->
v
.
TryUnionCase
.
IsNon
e
|
RecdOrClass
v
->
ValueOption
.
isNone
v
.
TryRecdField
|
Union
(
v
,
_)
->
ValueOption
.
isNone
v
.
TryUnionCas
e
|
ILField
_
->
false
let
checkIsResolved
()
=
checkEntityIsResolved
d
.
DeclaringTyconRef
match
d
with
|
RecdOrClass
v
->
if
v
.
TryRecdField
.
IsNone
then
if
ValueOption
.
isNone
v
.
TryRecdField
then
invalidOp
(
sprintf
"The record field '%s' could not be found in the target type"
v
.
FieldName
)
|
Union
(
v
,
_)
->
if
v
.
TryUnionCase
.
IsNon
e
then
if
ValueOption
.
isNone
v
.
TryUnionCas
e
then
invalidOp
(
sprintf
"The union case '%s' could not be found in the target type"
v
.
CaseName
)
|
ILField
_
->
()
...
...
@@ -1331,7 +1331,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
let
isUnresolved
()
=
match
fsharpInfo
()
with
|
None
->
false
|
Some
v
->
v
.
TryDeref
.
IsNone
|
Some
v
->
ValueOption
.
isNone
v
.
TryDeref
let
checkIsResolved
()
=
if
isUnresolved
()
then
...
...
src/fsharp/tast.fs
浏览文件 @
496c70d0
...
...
@@ -3260,7 +3260,7 @@ and
ValueSome
tcr
.
binding
/// Is the destination assembly available?
member
tcr
.
CanDeref
=
tcr
.
TryDeref
.
IsSome
member
tcr
.
CanDeref
=
ValueOption
.
isSome
tcr
.
TryDeref
/// Gets the data indicating the compiled representation of a type or module in terms of Abstract IL data structures.
member
x
.
CompiledRepresentation
=
x
.
Deref
.
CompiledRepresentation
...
...
@@ -3811,7 +3811,7 @@ and
|
None
->
error
(
InternalError
(
sprintf
"union case %s not found in type %s"
x
.
CaseName
x
.
TyconRef
.
LogicalName
,
x
.
TyconRef
.
Range
))
/// Try to dereference the reference
member
x
.
TryUnionCase
=
x
.
TyconRef
.
TryDeref
|>
ValueOption
.
bind
(
fun
tcref
->
tcref
.
GetUnionCaseByName
x
.
CaseName
|>
ValueOption
.
ofOption
)
member
x
.
TryUnionCase
=
x
.
TyconRef
.
TryDeref
|>
ValueOption
.
bind
(
fun
tcref
->
tcref
.
GetUnionCaseByName
x
.
CaseName
|>
ValueOption
.
ofOption
)
/// Get the attributes associated with the union case
member
x
.
Attribs
=
x
.
UnionCase
.
Attribs
...
...
@@ -5447,9 +5447,9 @@ let primEntityRefEq compilingFslib fslibCcu (x : EntityRef) (y : EntityRef) =
// The tcrefs may have forwarders. If they may possibly be equal then resolve them to get their canonical references
// and compare those using pointer equality.
(
not
(
nonLocalRefDefinitelyNotEq
x
.
nlr
y
.
nlr
)
&&
let
v1
=
x
.
TryDeref
let
v2
=
y
.
TryDeref
v1
.
IsSome
&&
v2
.
IsSome
&&
v1
.
Value
===
v2
.
Valu
e
))
then
match
x
.
TryDeref
with
|
ValueSome
v1
->
match
y
.
TryDeref
with
ValueSome
v2
->
v1
===
v2
|
_
->
false
|
_
->
match
y
.
TryDeref
with
ValueNone
->
true
|
_
->
fals
e
))
then
true
else
compilingFslib
&&
fslibEntityRefEq
fslibCcu
x
y
...
...
@@ -5473,9 +5473,9 @@ let primValRefEq compilingFslib fslibCcu (x : ValRef) (y : ValRef) =
else
(//
Use
TryDeref
to
guard
against
the
platforms
/
times
when
certain
F
#
language
features
aren't
available
,
// e.g. CompactFramework doesn't have support for quotations.
let
v1
=
x
.
TryDeref
let
v2
=
y
.
TryDeref
v1
.
IsSome
&&
v2
.
IsSome
&&
v1
.
Value
===
v2
.
Valu
e
)
match
x
.
TryDeref
with
|
ValueSome
v1
->
match
y
.
TryDeref
with
ValueSome
v2
->
v1
===
v2
|
_
->
false
|
_
->
match
y
.
TryDeref
with
ValueNone
->
true
|
_
->
fals
e
)
||
(
if
compilingFslib
then
fslibValRefEq
fslibCcu
x
y
else
false
)
//---------------------------------------------------------------------------
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录