Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/Compiler/Driver/FxResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ type internal FxResolver

let getImplementationAssemblyDir () = implementationAssemblyDir.Force()

let getFSharpCoreLibraryName = "FSharp.Core"

let getFsiLibraryName = "FSharp.Compiler.Interactive.Settings"

// Use the FSharp.Core that is executing with the compiler as a backup reference
let getFSharpCoreImplementationReference () =
Path.Combine(getFSharpCompilerLocation (), getFSharpCoreLibraryName + ".dll")
Expand Down Expand Up @@ -586,7 +582,7 @@ type internal FxResolver

getFSharpCoreLibraryName
if useFsiAuxLib then
fsiLibraryName
getFsiLibraryName

// always include a default reference to System.ValueTuple.dll in scripts and out-of-project sources
match getSystemValueTupleImplementationReference () with
Expand Down
5 changes: 3 additions & 2 deletions src/Compiler/Facilities/CompilerLocation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ module internal FSharpEnvironment =
let getCompilerToolsDesignTimeAssemblyPaths compilerToolPaths = searchToolPaths None compilerToolPaths

let getFSharpCoreLibraryName = "FSharp.Core"
let fsiLibraryName = "FSharp.Compiler.Interactive.Settings"

let getFsiLibraryName = "FSharp.Compiler.Interactive.Settings"

let getFSharpCompilerLocationWithDefaultFromType (defaultLocation: Type) =
let location =
Expand Down Expand Up @@ -262,7 +263,7 @@ module internal FSharpEnvironment =

// Must be alongside the location of FSharp.CompilerService.dll
let getDefaultFsiLibraryLocation () =
Path.Combine(Path.GetDirectoryName(getFSharpCompilerLocation ()), fsiLibraryName + ".dll")
Path.Combine(Path.GetDirectoryName(getFSharpCompilerLocation ()), getFsiLibraryName + ".dll")

let isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)

Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/Facilities/CompilerLocation.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ module internal FSharpEnvironment =

val getCompilerToolsDesignTimeAssemblyPaths: compilerToolPaths: seq<string> -> seq<string>

val fsiLibraryName: string

val getFSharpCoreLibraryName: string

val getFsiLibraryName: string

val isWindows: bool

val dotnet: string
Expand Down
91 changes: 58 additions & 33 deletions src/Compiler/TypedTree/TcGlobals.fs

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/Compiler/TypedTree/TypedTreeBasics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@ let mkNonLocalEntityRef ccu mp = NonLocalEntityRef(ccu, mp)
let mkNestedNonLocalEntityRef (nleref: NonLocalEntityRef) id =
mkNonLocalEntityRef nleref.Ccu (Array.append nleref.Path [| id |])

// If the topleveloperator has been moved to a new module
// attempt to find the newmodule
// if the new module is found all is good.
// otherwise use
// if the fallbacknlref is not found then return the new module so the error message
// is modernised, otherwise return the fallbacknlref
let mkRelocatedNestedNonLocalEntityRef nleref newId (fallbacknlref: NonLocalEntityRef) =
let nleref = mkNestedNonLocalEntityRef nleref newId
match nleref.TryDeref(false) with
| ValueNone ->
match fallbacknlref.TryDeref(false) with
| ValueNone -> nleref
| ValueSome _ -> fallbacknlref
| ValueSome _ -> nleref

let mkNonLocalTyconRef nleref id = ERefNonLocal (mkNestedNonLocalEntityRef nleref id)

let mkNonLocalTyconRefPreResolved x nleref id =
Expand Down
3 changes: 3 additions & 0 deletions src/Compiler/TypedTree/TypedTreeBasics.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ val mkNonLocalEntityRef: ccu: CcuThunk -> mp: string[] -> NonLocalEntityRef

val mkNestedNonLocalEntityRef: nleref: NonLocalEntityRef -> id: string -> NonLocalEntityRef

val mkRelocatedNestedNonLocalEntityRef:
nleref: NonLocalEntityRef -> newId: string -> fallbacknlref: NonLocalEntityRef -> NonLocalEntityRef

val mkNonLocalTyconRef: nleref: NonLocalEntityRef -> id: string -> EntityRef

val mkNonLocalTyconRefPreResolved: x: NonNullSlot<Entity> -> nleref: NonLocalEntityRef -> id: string -> EntityRef
Expand Down
8 changes: 7 additions & 1 deletion src/Compiler/TypedTree/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,13 @@ type DisplayEnv =
FSharpLib.CorePath
CollectionsPath
ControlPath
(splitNamespace ExtraTopLevelOperatorsName) ]
MFSeqGlobalOperatorsPath
MFSetGlobalOperatorsPath
MFPrintfGlobalOperatorsPath
MFAsyncGlobalOperatorsPath
MFQueryGlobalOperatorsPath
ExtraTopLevelOperatorsPath
]

let (+.+) s1 s2 = if s1 = "" then s2 else s1+"."+s2

Expand Down
3 changes: 3 additions & 0 deletions src/FSharp.Core/FSharp.Core.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
<Compile Include="prim-types.fs">
<Link>Primitives/prim-types.fs</Link>
</Compile>
<Compile Include="prim-types-epilog.fs">
<Link>Primitives/prim-types-epilog.fs</Link>
</Compile>
<Compile Include="local.fsi">
<Link>Collections/local.fsi</Link>
</Compile>
Expand Down
12 changes: 6 additions & 6 deletions src/FSharp.Core/Linq.fs
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ module LeafExpressionConverter =
let (|ConvIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.nativeint x))
let (|ConvUIntPtrQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.unativeint x))

let (|ConvInt8Q|_|) = SpecificCallToMethodInfo (typeof<ConvEnv>.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToSByte"))
let (|ConvUInt8Q|_|) = SpecificCallToMethodInfo (typeof<ConvEnv>.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToByte"))
let (|ConvDoubleQ|_|) = SpecificCallToMethodInfo (typeof<ConvEnv>.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToDouble"))
let (|ConvSingleQ|_|) = SpecificCallToMethodInfo (typeof<ConvEnv>.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators").GetMethod("ToSingle"))
let (|ConvInt8Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.int8 x))
let (|ConvUInt8Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint8 x))
let (|ConvDoubleQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.double x))
let (|ConvSingleQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.single x))

let (|ConvNullableCharQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.char x))
let (|ConvNullableDecimalQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Nullable.decimal x))
Expand All @@ -374,8 +374,8 @@ module LeafExpressionConverter =
let (|TypeTestGeneric|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric x))
let (|CheckedConvCharQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.char x))
let (|CheckedConvSByteQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.sbyte x))
let (|CheckedConvInt8Q|_|) = SpecificCallToMethodInfo (typeof<ConvEnv>.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators+Checked").GetMethod("ToSByte"))
let (|CheckedConvUInt8Q|_|) = SpecificCallToMethodInfo (typeof<ConvEnv>.Assembly.GetType("Microsoft.FSharp.Core.ExtraTopLevelOperators+Checked").GetMethod("ToByte"))
let (|CheckedConvInt8Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.int8 x))
let (|CheckedConvUInt8Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Operators.uint8 x))
let (|CheckedConvInt16Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.int16 x))
let (|CheckedConvInt32Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.int32 x))
let (|CheckedConvInt64Q|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun x -> Checked.int64 x))
Expand Down
10 changes: 10 additions & 0 deletions src/FSharp.Core/Query.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1929,4 +1929,14 @@ module Query =
member _.EliminateNestedQueries e = EliminateNestedQueries e
}

namespace Microsoft.FSharp.Core

[<AutoOpen>]
module QueryGlobalOperators =

let query = Microsoft.FSharp.Linq.QueryBuilder()


[<assembly: AutoOpen("Microsoft.FSharp.Linq.QueryRunExtensions.LowPriority")>]
[<assembly: AutoOpen("Microsoft.FSharp.Linq.QueryRunExtensions.HighPriority")>]
do ()
25 changes: 25 additions & 0 deletions src/FSharp.Core/Query.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,28 @@ namespace Microsoft.FSharp.Linq.QueryRunExtensions
/// </summary>
[<CompiledName("RunQueryAsEnumerable")>]
member Run: Microsoft.FSharp.Quotations.Expr<Microsoft.FSharp.Linq.QuerySource<'T,System.Collections.IEnumerable>> -> Microsoft.FSharp.Collections.seq<'T>

namespace Microsoft.FSharp.Core

[<AutoOpen>]
module QueryGlobalOperators =

/// <summary>Builds a query using query syntax and operators.</summary>
///
/// <example id="query-1">
/// <code lang="fsharp">
/// let findEvensAndSortAndDouble(xs: System.Linq.IQueryable&lt;int>) =
/// query {
/// for x in xs do
/// where (x % 2 = 0)
/// sortBy x
/// select (x+x)
/// }
///
/// let data = [1; 2; 6; 7; 3; 6; 2; 1]
///
/// findEvensAndSortAndDouble (data.AsQueryable()) |> Seq.toList
/// </code>
/// Evaluates to <c>[4; 4; 12; 12]</c>.
/// </example>
val query: Microsoft.FSharp.Linq.QueryBuilder
10 changes: 10 additions & 0 deletions src/FSharp.Core/async.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2370,3 +2370,13 @@ module WebExtensions =
start = (fun userToken -> this.DownloadFileAsync(address, fileName, userToken)),
result = (fun _ -> ())
)

namespace Microsoft.FSharp.Control

open Microsoft.FSharp.Core

[<AutoOpen>]
module AsyncGlobalOperators =

[<CompiledName("DefaultAsyncBuilder")>]
let async = AsyncBuilder()
25 changes: 25 additions & 0 deletions src/FSharp.Core/async.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -1547,3 +1547,28 @@ namespace Microsoft.FSharp.Control
module internal AsyncBuilderImpl =
val async : AsyncBuilder

namespace Microsoft.FSharp.Control

open Microsoft.FSharp.Core

[<AutoOpen>]
module AsyncGlobalOperators =

/// <summary>Builds an asynchronous workflow using computation expression syntax.</summary>
///
/// <example id="async-1">
/// <code lang="fsharp">
/// let sleepExample() =
/// async {
/// printfn "sleeping"
/// do! Async.Sleep 10
/// printfn "waking up"
/// return 6
/// }
///
/// sleepExample() |> Async.RunSynchronously
/// </code>
/// </example>
[<CompiledName("DefaultAsyncBuilder")>]
val async: Microsoft.FSharp.Control.AsyncBuilder

Loading