Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
e789aca4
F
fsharp
项目概览
dotNET Platform
/
fsharp
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
e789aca4
编写于
8月 22, 2017
作者:
K
Kevin Ransom
提交者:
Kevin Ransom (msft)
8月 22, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FX_NO_BASED_ARRAYS --- dead code removal
上级
75e37cdf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
30 deletion
+4
-30
src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs
.../FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs
+4
-24
src/fsharp/FSharp.Core/array2.fs
src/fsharp/FSharp.Core/array2.fs
+0
-4
src/fsharp/FSharp.Core/array2.fsi
src/fsharp/FSharp.Core/array2.fsi
+0
-2
未找到文件。
src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs
浏览文件 @
e789aca4
...
...
@@ -30,14 +30,12 @@ type Array2Module() =
if
i
=
0
then
System
.
Math
.
Sin
(
arg
)
else
System
.
Math
.
Cos
(
arg
))
let
resultInt
=
Array2D
.
base1
intArr
if
resultInt
<>
0
then
Assert
.
Fail
()
#
if
FX_NO_BASED_ARRAYS
#
else
// string array
let
strArr
=
Array2D
.
createBased
0
0
2
3
"goodboy"
let
resultStr
=
Array2D
.
base1
strArr
if
resultStr
<>
0
then
Assert
.
Fail
()
#
endif
// empty array
let
eptArr
=
Array2D
.
create
0
0
1
let
resultEpt
=
Array2D
.
base1
eptArr
...
...
@@ -60,13 +58,11 @@ type Array2Module() =
let
resultInt
=
Array2D
.
base2
intArr
if
resultInt
<>
0
then
Assert
.
Fail
()
#
if
!
FX_NO_BASED_ARRAYS
// string array
let
strArr
=
Array2D
.
createBased
0
0
2
3
"goodboy"
let
resultStr
=
Array2D
.
base2
strArr
if
resultStr
<>
0
then
Assert
.
Fail
()
#
endif
// empty array
let
eptArr
=
Array2D
.
create
0
0
1
let
resultEpt
=
Array2D
.
base2
eptArr
...
...
@@ -76,13 +72,11 @@ type Array2Module() =
let
nullArr
=
null
:
string
[,]
CheckThrowsNullRefException
(
fun
()
->
Array2D
.
base2
nullArr
|>
ignore
)
#
if
!
FX_NO_BASED_ARRAYS
// Verify printing format of non-zero based arrays
let
v
:
int
[,]
=
Array2D
.
createBased
10
1
3
4
2
let
actual
=
(
sprintf
"%A"
v
).
Replace
(
"
\r
"
,
""
).
Replace
(
"
\n
"
,
""
)
let
expected
=
"[bound1=10 bound2=1 [2; 2; 2; 2] [2; 2; 2; 2] [2; 2; 2; 2]]"
Assert
.
AreEqual
(
expected
,
actual
)
#
endif
()
[<
Test
>]
...
...
@@ -131,7 +125,6 @@ type Array2Module() =
CheckThrowsArgumentException
(
fun
()
->
Array2D
.
blit
intArr
0
0
intArr2
0
10
2
2
|>
ignore
)
()
#
if
!
FX_NO_BASED_ARRAYS
[<
Test
>]
member
this
.
BlitWithNonZeroBase
()
=
let
a
=
Array2D
.
createBased
1
1
3
3
0
...
...
@@ -184,7 +177,6 @@ type Array2Module() =
CheckThrowsArgumentException
(
fun
()
->
Array2D
.
blit
a
1
1
b
1
1
4
4
|>
ignore
)
()
#
endif
[<
Test
>]
member
this
.
Copy
()
=
...
...
@@ -230,7 +222,6 @@ type Array2Module() =
()
#
if
!
FX_NO_BASED_ARRAYS
[<
Test
>]
member
this
.
createBased
()
=
// integer array
...
...
@@ -249,7 +240,6 @@ type Array2Module() =
let
resultEpt
=
Array2D
.
createBased
0
0
0
0
1
if
resultEpt
<>
eptArr
then
Assert
.
Fail
()
()
#
endif
[<
Test
>]
member
this
.
Get
()
=
...
...
@@ -285,26 +275,21 @@ type Array2Module() =
let
intArr
=
Array2D
.
init
2
3
(
fun
i
j
->
i
*
100
+
j
)
if
intArr
.[
1
,
1
]
<>
101
then
Assert
.
Fail
()
// string array
let
strArr
=
Array2D
.
init
2
3
(
fun
i
j
->
i
.
ToString
()
+
"-"
+
j
.
ToString
()
)
if
strArr
.[
1
,
1
]
<>
"1-1"
then
Assert
.
Fail
()
()
#
if
!
FX_NO_BASED_ARRAYS
[<
Test
>]
member
this
.
Init_Based
()
=
// integer array
let
intArr
=
Array2D
.
initBased
1
1
2
3
(
fun
i
j
->
i
*
100
+
j
)
if
intArr
.[
2
,
2
]
<>
202
then
Assert
.
Fail
()
// string array
let
strArr
=
Array2D
.
initBased
1
1
2
3
(
fun
i
j
->
i
.
ToString
()
+
"-"
+
j
.
ToString
()
)
if
strArr
.[
2
,
2
]
<>
"2-2"
then
Assert
.
Fail
()
()
#
endif
[<
Test
>]
member
this
.
Iter
()
=
...
...
@@ -331,7 +316,6 @@ type Array2Module() =
CheckThrowsArgumentNullException
(
fun
()
->
Array2D
.
iter
funStr
nullArr
|>
ignore
)
()
#
if
!
FX_NO_BASED_ARRAYS
[<
Test
>]
member
this
.
IterNonZeroBased
()
=
let
a
=
Array2D
.
createBased
1
5
10
10
1
...
...
@@ -343,8 +327,6 @@ type Array2Module() =
if
!
result
<>
1600
then
Assert
.
Fail
()
()
#
endif
[<
Test
>]
member
this
.
Iteri
()
=
// integer array
...
...
@@ -470,7 +452,6 @@ type Array2Module() =
()
#
if
!
FX_NO_BASED_ARRAYS
[<
Test
>]
member
this
.
Rebase
()
=
// integer array
...
...
@@ -494,7 +475,6 @@ type Array2Module() =
CheckThrowsArgumentNullException
(
fun
()
->
Array2D
.
rebase
nullArr
|>
ignore
)
()
#
endif
[<
Test
>]
member
this
.
Set
()
=
...
...
src/fsharp/FSharp.Core/array2.fs
浏览文件 @
e789aca4
...
...
@@ -51,11 +51,7 @@ namespace Microsoft.FSharp.Collections
(
System
.
Array
.
CreateInstance
(
typeof
<
'
T
>,
[|
n1
;
n2
|])
:?>
'
T
[,])
#
endif
else
#
if
FX_NO_BASED_ARRAYS
raise
(
NotSupportedException
(
SR
.
GetString
(
SR
.
nonZeroBasedDisallowed
)))
#
else
(
Array
.
CreateInstance
(
typeof
<
'
T
>,
[|
n1
;
n2
|],[|
b1
;
b2
|])
:?>
'
T
[,])
#
endif
[<
CompiledName
(
"CreateBased"
)>]
let
createBased
b1
b2
n
m
(
x
:
'
T
)
=
...
...
src/fsharp/FSharp.Core/array2.fsi
浏览文件 @
e789aca4
...
...
@@ -95,7 +95,6 @@ namespace Microsoft.FSharp.Collections
[<
CompiledName
(
"ZeroCreate"
)>]
val
zeroCreate
:
length1
:
int
->
length2
:
int
->
'
T
[,]
#
if
!
FX_NO_BASED_ARRAYS
/// <summary>Creates a based array given the dimensions and a generator function to compute the elements.</summary>
///
/// <param name="base1">The base for the first dimension of the array.</param>
...
...
@@ -133,7 +132,6 @@ namespace Microsoft.FSharp.Collections
/// <exception cref="System.ArgumentException">Thrown when base1, base2, length1, or length2 is negative.</exception>
[<
CompiledName
(
"ZeroCreateBased"
)>]
val
zeroCreateBased
:
base1
:
int
->
base2
:
int
->
length1
:
int
->
length2
:
int
->
'
T
[,]
#
endif
/// <summary>Applies the given function to each element of the array.</summary>
///
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录