-
Notifications
You must be signed in to change notification settings - Fork 860
Expand file tree
/
Copy pathStaticMethodResolution.fs
More file actions
33 lines (25 loc) · 995 Bytes
/
StaticMethodResolution.fs
File metadata and controls
33 lines (25 loc) · 995 Bytes
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
33
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Conformance.BasicGrammarElements
open FSharp.Test.Compiler
open Xunit
module StaticMethodResolution =
// So that the compiler doesn't treat an extension method as intrinsic
// we place a method to another module.
[<Fact>]
let ``Extension static method is resolved correctly when one or many intrinsic candidates are found``() =
Fsx """
module Extensions =
type StaticGeneric<'T>() =
static member Bar() = ()
[<AutoOpen>]
module StaticGenericExtensions =
type StaticGeneric<'T> with
static member Bar(_: int) = ()
module Program =
open Extensions
StaticGeneric.Bar(42) // StaticGeneric is just an ident
StaticGeneric<int>.Bar(42) // StaticGeneric<int> is an expression
"""
|> withOptions ["--nowarn:1125"]
|> typecheck
|> shouldSucceed