forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMisc.fs
32 lines (24 loc) · 800 Bytes
/
Misc.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace EmittedIL
open Xunit
open FSharp.Test.Compiler
module ``Misc`` =
[<Fact>]
let ``Empty array construct compiles to System.Array.Empty<_>()``() =
FSharp """
module Misc
let zInt (): int[] = [||]
let zString (): string[] = [||]
let zGeneric<'a> (): 'a[] = [||]
"""
|> compile
|> shouldSucceed
|> verifyIL ["""
IL_0000: call !!0[] [runtime]System.Array::Empty<int32>()
IL_0005: ret"""
"""
IL_0000: call !!0[] [runtime]System.Array::Empty<string>()
IL_0005: ret"""
"""
IL_0000: call !!0[] [runtime]System.Array::Empty<!!0>()
IL_0005: ret""" ]