-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Microsoft optional in namepsace paths from FSharp.Core
commit 4273c5af3e9d5ff60e9eca2d60c92c06c87ebdeb Merge: df8b476 d301929 Author: latkin <latkin@microsoft.com> Date: Thu Jan 8 13:07:38 2015 -0800 Merge branch 'msft-optional' of https://git01.codeplex.com/forks/dsyme/cleanup into msftnamespace commit d301929def6926050c8b6e33dd2f621398162784 Author: Don Syme <dsyme@microsoft.com> Date: Tue Dec 2 15:10:33 2014 +0000 add more tests commit 5e2731b91bd6bc67c1d0252a4de9aade2d2e2809 Author: Don Syme <dsyme@microsoft.com> Date: Tue Dec 2 15:07:43 2014 +0000 update code comment commit 72c3bf1facd8c0684be838396b7d627e61959bc5 Author: Don Syme <dsyme@microsoft.com> Date: Tue Sep 16 16:18:51 2014 +0100 Make Microsoft optional in namepsace paths from FSharp.Core
- Loading branch information
Showing
6 changed files
with
192 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This test is related to F# 4.0+ design change "https://fslang.uservoice.com/forums/245727-f-language/suggestions/6107641-make-microsoft-prefix-optional-when-using-core-f" | ||
// | ||
// In this test, we check we can do basic operations like "open FSharp.Collections" without needing the "Microsoft" prefix | ||
|
||
module Pos18 = | ||
// Check we can open 'FSharp.Collections' unqualified, without warning | ||
open FSharp.Collections | ||
|
||
// Check we can open 'FSharp.Quotations' unqualified, without warning | ||
open FSharp.Quotations | ||
|
||
let v = Expr.Value 3 | ||
|
||
// Check we can access 'FSharp.Quotations' via full path | ||
let v2 = FSharp.Quotations.Expr.Value 3 | ||
|
||
// Check we can access 'FSharp.Quotations' via 'global' | ||
let v3 = global.FSharp.Quotations.Expr.Value 3 | ||
|
||
module Pos18b = | ||
open Microsoft // Adding "open Microsoft" shouldn't trigger additional warnings | ||
|
||
// Check we can open 'FSharp.Collections' unqualified, without warning | ||
open FSharp.Collections | ||
|
||
// Check we can open 'FSharp.Quotations' unqualified, without warning | ||
open FSharp.Quotations | ||
|
||
let v = Expr.Value 3 | ||
|
||
// Check we can access 'FSharp.Quotations' via full path | ||
let v2 = FSharp.Quotations.Expr.Value 3 | ||
|
||
// Check we can access 'FSharp.Quotations' via 'global' | ||
let v3 = global.FSharp.Quotations.Expr.Value 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
|
||
// This test is related to F# 4.0+ design change "https://fslang.uservoice.com/forums/245727-f-language/suggestions/6107641-make-microsoft-prefix-optional-when-using-core-f" | ||
// | ||
// In this test, we simulate user code that has defined types in FSharp.Collections. We check that the resolution | ||
// of types in FSharp.Collections proceeds as previously for user-defined types. | ||
|
||
namespace FSharp.Collections | ||
|
||
type List<'T> = A | B | ||
type Map<'T> = C | D | ||
|
||
|
||
namespace Pos19 | ||
|
||
module N = | ||
open FSharp.Collections | ||
|
||
// check "List" resolves to the FSharp.Collections.List defined above | ||
let f (x: List<int>) = | ||
match x with | ||
| A -> 1 | ||
| B -> 2 | ||
|
||
let y = f A | ||
|
||
namespace Test3 | ||
|
||
module N = | ||
open FSharp.Collections | ||
|
||
// check "List" resolves to the FSharp.Collections.List defined above | ||
let f1 (x: List<int>) = | ||
match x with | ||
| A -> 1 | ||
| B -> 2 | ||
|
||
let y1 = f1 A | ||
|
||
// check "List" resolves to the FSharp.Collections.List defined above | ||
let f2 (x: global.FSharp.Collections.List<int>) = | ||
match x with | ||
| A -> 1 | ||
| B -> 2 | ||
|
||
let y2 = f2 A | ||
|
||
// check "List" resolves to the FSharp.Collections.List defined above | ||
let f3 (x: FSharp.Collections.List<int>) = | ||
match x with | ||
| A -> 1 | ||
| B -> 2 | ||
|
||
let y3 = f3 A | ||
|
||
|
||
// check "Map" resolves to the FSharp.Collections.List defined above | ||
let g1 (x: Map<int>) = | ||
match x with | ||
| C -> 1 | ||
| D -> 2 | ||
|
||
let z1 = g1 C | ||
|
||
// check "List" resolves to the FSharp.Collections.List defined above | ||
let g2 (x: global.FSharp.Collections.Map<int>) = | ||
match x with | ||
| C -> 1 | ||
| D -> 2 | ||
|
||
let z2 = g2 C | ||
|
||
|
||
// check "List" resolves to the FSharp.Collections.List defined above | ||
let g3 (x: FSharp.Collections.Map<int>) = | ||
match x with | ||
| C -> 1 | ||
| D -> 2 | ||
|
||
let z3 = g3 C |