Giter Site home page Giter Site logo

fsharp-compiler-docs's Introduction

The F# repository has moved

Please go to https://github.com/dotnet/fsharp/. All contributions to the F# compiler/library/tools now go there.

This repository is the old repository for alternative packagings of F#. See notes below for historical notes on these. The core logic of F# is made available as a library component called FSharp.Compiler.Service, and F# is open source, so an unlimited number of other packagings of F# are possible.

Archival: Details on the various Alternative Packagings

Archival: The FSharp.Compiler.Tools NuGet package

This repo is currently used to make the FSharp.Compiler.Tools NuGet package. This package includes the following for both .NET Core and .NET Framework/Mono:

  • the F# compiler fsc.exe
  • F# Interactive fsi.exe
  • build support,
  • a copy of FSharp.Core used to run the tools
  • related DLLs.

The NuGet packages are exactly the ones produced by AppVeyor CI, e.g. for version 4.1.2. They are pushed to https://nuget.org by someone with appropriate permissions.

The FSharp.Compiler.Tools NuGet package can be used if you wish to use the latest F# compiler on a computer without relying on the installed version of Visual Studio. Adding it via NuGet to a project will override the in-box compiler with the compiler from the NuGet package. Note: you will need to manually modify your project file once (see #676).

Archival: The fsharp Debian Linux Package

Usage: See http://fsharp.org/use/linux

apt-get install fsharp

See the mono packaging repo, which is a downstream variant of this repo, where this package is actually made.

  • There is a tag for each upstream source tag
  • There is a tag for each "debianized" package
  • Packaging metadata lives in debian/
  • install files are files installed to disk
  • cligacinstall are GAC-installed libraries
  • control is the manifest of packages
  • rules is the Makefile which handles build/install.

Jo Shields (@directhex) has done much of this work and says:

I tend to only update the published packages when a) the same update has already been pulled in on Mac by Jason, and either b) something breaks horribly in the existing version on a new Mono, or c) someone explicitly asks me to.

Linux package delivery is (now) based on packages built on our public Jenkins instance, and published automatically as a post-build step, based on two inputs - a Git repository in standard Debian git packaging format (which https://github.com/mono/linux-packaging-fsharp already is), and a tarball to consider as the canonical source of the next release (giving the same tarball in subsequent builds is how you indicate packaging-only changes such as alterations to metadata in debian/)

Alexander Köplinger has admin access to Jenkins, SSH access to the Jenkins and repository servers, and has taken care of things for me in my absence in the past (but isn't a Debian packaging expert, so would be trusting that metadata changes are solid)

Archival: F# packaging in Mono + macOS

F# is packaged as part of Mono on macOS. Jason Imison says:

We use a system called BockBuild that pushes versions of F# (sometimes with patches) out with Mono for macOS (F# is bundled with mono here, not a separate package).

You can see an example build script here (if you have access, ping me if not) https://github.com/xamarin/bockbuild/blob/2017-02/packages/fsharp.py. Unfortunately, you need to know the branch name here – 2017-02 is what is going to be released with VS for Mac aka Mono 4.9.x

We build fsharp/fsharp internally so that we’re not dependent on you pushing out fixes / bumping packages. Miguel de Icaza likes to ‘own’ the code that we ship precisely to stop these kind of emergency issues.

@cartermp says:

For future reference, dependencies and code for the F# editing and F# Interactive support in Visual Studio for Mac/Xamarin Studio is here

Archival: History

See https://fsharp.org/history

F# compiler sources as initially dropped are available from fsharppowerpack.codeplex.com.

On 4 April 2014, Microsoft Open Tech published the F# compiler sources at http://visualfsharp.codeplex.com and began accepting contributions to the F# compiler/library and tools.

In 2016 the http://visualfsharp.codeplex.com repo moved to GitHub at https://github.com/Microsoft/visualfsharp.

In 2019 the .NET Foundation and the F# community unified repositories at https://github.com/dotnet/fsharp.

fsharp-compiler-docs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fsharp-compiler-docs's Issues

CompileToDynamicAssembly error "Duplicate type name within an assembly." when using SqlDataConnection type provider

When I use a SqlDataConnection type provider and use the CompileToDynamicAssembly method to compile, the following exception is thrown: System.ArgumentException: Duplicate type name within an assembly.

The exception is not thrown if the regular Compile() method is used.

Relevant code

#r @"FSharp.Compiler.Service.dll"

open System.IO
open Microsoft.FSharp.Compiler.SimpleSourceCodeServices

let scs = SimpleSourceCodeServices()
let sourceFileName = @"Test.fsx"
let dllFileName = Path.ChangeExtension(sourceFileName, "dll")
let code = @"
#r ""System.Data.dll""
#r ""FSharp.Data.TypeProviders.dll""
#r ""System.Data.Linq.dll""

open Microsoft.FSharp.Data.TypeProviders

type dbSchema = SqlDataConnection<ConnectionString = ""Data Source=localhost\sqlexpress;Initial Catalog=master;Integrated Security=True;"">
"

File.WriteAllText(sourceFileName, code)

// build the arguments
let arguments =
    [|
        yield "fsc.exe"
        yield "-o"
        yield dllFileName
        yield "-a"
        yield sourceFileName
    |]

let (errors, exitCode, assembly) = scs.CompileToDynamicAssembly(arguments, None) // exception
let (errors2, exitCode2) = scs.Compile(arguments) // no exception

No symbol returned for namespaces

Given the following code:

module Lists =
    let testDate = System.DateTime.DaysInMonth(2014, 1)

module BoilerPlateForForm =
    [<System.STAThread>]
    do ()

With a symbol request of let testDate = S§ystem.DateTime.DaysInMonth(2014, 1)
using: GetSymbolAtLocation: line: 1, Col: 20, Line: let testDate = System.DateTime.DaysInMonth(2014, 1), ident: ["System"]

No result is returned

Inconsistent symbol range returned for GetUsesOfSymbol

Given the following code:

module Lists =
    let testDate = System.DateTime.DaysInMonth(2014, 1)

module BoilerPlateForForm =
    [<System.STAThread>]
    do ()

If a symbol request is made at: let testDate = System.D§ateTime.DaysInMonth(2014, 1)

then the following range is returned:

Symbol usage: ("/Users/dave/Projects/tutorial/tutorial/Tutorial.fs", ((1, 26), (1, 34)))

which is DateTime

However if this is requested: let testDate = System.DateTime.D§aysInMonth(2014, 1)

Then the following is returned:

Symbol usage: ("/Users/dave/Projects/tutorial/tutorial/Tutorial.fs", ((1, 19), (1, 46)))

which is System.DateTime.DaysInMonth

XmlDoc vs XmlDocSig

Hi. I'm trying to add the xml docs from typeproviders to FSharp.Formatting. I noticed that XmlDoc has content for them, but not XmlDocSig, which is what's FSharp.Formatting is using. Can someone please explain me the difference from XmlDocSig and XmlDoc in FSharpEntity?

Provide a way to check for Active Patterns labels

For example:

let (|Even|Odd|) input = if input % 2 = 0 then Even else Odd

let TestNumber input =
   match input with
   | Even -> printfn "%d is even" input
   | Odd -> printfn "%d is odd" input

I would like to check whether Even and Odd symbols are Active Patterns labels. It's currently not possible with FSharpSymbol.

Also please provide a way to get these labels from Active Patterns functions e.g. (|Even|Odd|).

(See related comment fsprojects-archive/zzarchive-VisualFSharpPowerTools#77 (comment))

AST introspection within F# Interactive

Let me start by saying that I am very pleased to see this project turn up, particularly since it has the potential of making my work with mbrace much easier. I am refering to the mbrace shell, which is essentially a modified fsi capable of persisting interactions to assembly files for distribution.

I would like to propose adding a custom version of F# interactive that is capable of introspecting the AST's (be they typed or untyped) of its own interactions. The api would be something along the lines of adding a static facade in the FSharp.Compiler.Service.Shell namespace that looks like this:

type ShellIntrospection =
  class
    static member IsFsiProcess : bool
    static member GetInteractionAst : idx:int -> ParsedInput list
  end

Assuming that the IsFsiProcess property is true, calling GetInteractionAst with argument 1 would return the AST for interaction FSI_0001, assuming it has already materialized.

If you want, I could contribute the relevant code.

Improve type tooltips for types emitted from type providers

The tooltips usually show something like JsonProvider<...>.TypeA. When you're trying to refactor code and need to put type annotation, this is not every useful, because you can't put this type there. It would be better if it shown a type alias if there is one (there usually is in type provider usage), otherwise it's very confusing for new users.

Background: http://stackoverflow.com/questions/21402829/type-annotation-for-using-a-f-typeprovider-type-e-g-fsharp-data-jsonprovider/21406103

This also affects VS, but if we could fix it here (which would then propagate to XS), we could later try the VS team to get it also

Portable Library Version

Would be really excellent to host the F# compiler within a Windows Store, Windows Phone, etc. application for the purposes of exposing F# Interactive scripting, assuming that will eventually make it into this project.

Missing types in F# 3.1 branch

On adding the missing SimpleSourceCodeServices the following are missing on compilation:

.../FSharp.Compiler.Service_/src/fsharp/vs/SimpleServices.fs(178,23): error FS0039: The type 'ErrorLoggerProvider' is not defined
.../FSharp.Compiler.Service_/src/fsharp/vs/SimpleServices.fs(186,21): error FS0039: The value or constructor 'typecheckAndCompile' is not defined

To pass all unit tests on Windows, "F# Tools for Visual Studio Express 2012 for Web" must be installed.

I couldn't find any notes about this requirement, but is it intended?

When I uninstall "F# Tools for Visual Studio Express 2012 for Web",
I've got the following errors when running "build.cmd RunTests" command:

***** FSharp.Compiler.Service.Tests.FscTests.2. Simple FSC library test
args: [|"fsc.exe"; "--target:library"; "--debug:pdbonly";
"--pdb:C:\Users\yukitos\AppData\Local\Temp\2\Foo.pdb";
"--out:C:\Users\yukitos\AppData\Local\Temp\2\Foo.dll";
"C:\Users\yukitos\AppData\Local\Temp\2\Foo.fs"|]
error: unknown (0,0)-(0,80) parse error File 'C:\work\github\FSharp.Compiler.Service\bin\FSharp.Core.optdata' not found alongside FSharp.Core
error: unknown (0,0)-(0,80) parse error Error opening binary file 'C:\work\github\FSharp.Compiler.Service\bin\FSharp.Core.dll': File 'C:\work\github\FSharp.Compiler.Service\bin\FSharp.Core.optdata' not found alongside FSharp.Core
error: unknown (0,0)-(0,80) parse error Problem reading assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a': Error opening binary file 'C:\work\github\FSharp.Compiler.Service\bin\FSharp.Core.dll': File 'C:\work\github\FSharp.Compiler.Service\bin\FSharp.Core.optdata' not found alongside FSharp.Core

These errors have also been occurred during "3. Simple FSC executable test".

Please let me clarify requirements.
Thanks and regards,

Selfies

Perhaps I've watched one too many Alan Kay talks. Nevertheless, I'll throw this out there: I would like to invoke the compiler from within a F# project on itself. In other words, while writing the code, I would like to be able to have the compiler service build the current library by executing the compiler within the library.

I hope that makes sense. I know what I want to do, but I'm not sure how to explain it. Assuming you understand my request, does this version of the compiler allow it?

On extended use an error is raised: Could not find requested input '(startup (1,0--1,80)'

Heres a smaple stack trace that was reported from bugzilla 17796

System.Exception: Could not find requested input '(startup (1,0--1,80)
IsSynthetic=false,
 "C:\ws\Mono\GitHub\XaOpenXC\XaOpenXCCore\TinyLogging.fs", false)' named
'FileNames' in set [(0, Available('(startup (1,0--1,80) IsSynthetic=false,
C:\ws\Mono\GitHub\XaOpenXC\XaOpenXC\Resources\Resource.designer.fs, False)' as
of 2/15/2014 7:59:10 PM)); (1, Available('(startup (1,0--1,80)
IsSynthetic=false,
C:\ws\Mono\GitHub\XaOpenXC\XaOpenXC\Properties\AssemblyInfo.fs, False)' as of
2/15/2014 7:59:10 PM)); (2, Available('(startup (1,0--1,80) IsSynthetic=false,
C:\ws\Mono\GitHub\XaOpenXC\XaOpenXC\GaugeView.fs, False)' as of 2/15/2014
7:59:10 PM)); ... ]
   at
Microsoft.FSharp.Control.CancellationTokenOps.Start@1192-1.Invoke(Exception e)
   at <StartupCode$FSharp-Core>.$Control.loop@419-40(Trampoline this,
FSharpFunc`2 action)
   at Microsoft.FSharp.Control.Trampoline.ExecuteAction(FSharpFunc`2
firstAction)
   at Microsoft.FSharp.Control.TrampolineHolder.Protect(FSharpFunc`2
firstAction)
   at <StartupCode$FSharp-Core>[email protected](Object state)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object
state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at
System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Find Symbol misses implementation class.

This was originally raised in the F# addin (Rename misses method in implementation class)

OS: Mac OS X 10.9.1
Xamarin Studio: 4.2.3 (Build 54) [beta channel]
Mono: 3.2.6
F#: 3.0
F#Binding: 4.2.3 (manually installed from recent dfba3089ae217b82089a80fd4f9175d4f00f9ccc)

Having the following code:

type IFoo =
    abstract member name: string

type FooImpl(name: string) =
    interface IFoo with
        member this.name = name

let name_of (foo: IFoo) =
    foo.name

if I rename the name member to myName, then it is not refactored in the implementing class FooImpl (but it is refactored in the using function name_of). What I actually get after the rename is:

type IFoo =
    abstract member myName: string

type FooImpl(name: string) =
    interface IFoo with
        member this.name = name

let name_of (foo: IFoo) =
    foo.myName

Build fails (on my machine(tm))

I tried building the source and I'm getting three test failures on my machine. Here are the details for one of them:

1) Test Error : FSharp.Compiler.Service.Tests.FscTests.1. PEVerifier sanity check
   System.InvalidOperationException : Cannot start process because a file name has not been provided.
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at FSharp.Compiler.Service.Tests.FscTests.PEVerifier.execute(String fileName, String arguments) in c:\Tomas\Public\FSharp.Compiler.Service\tests\service\FscTests.fs:line 40
   at FSharp.Compiler.Service.Tests.FscTests.PEVerifier.Verify(String assemblyPath) in c:\Tomas\Public\FSharp.Compiler.Service\tests\service\FscTests.fs:line 47
   at FSharp.Compiler.Service.Tests.FscTests.1. PEVerifier sanity check() in c:\Tomas\Public\FSharp.Compiler.Service\tests\service\FscTests.fs:line 102

The other test failures look the same and are in:

    1. Test Error : FSharp.Compiler.Service.Tests.FscTests.2. Simple FSC library test
    1. Test Error : FSharp.Compiler.Service.Tests.FscTests.3. Simple FSC executable test

Document the FileSystem API

The FSharp.Compiler.Service has a FileSystem API available through the following mutable global:

Microsoft.FSharp.Compiler.AbstractIL.Internal.Library.Shim.FileSystem

Setting this means that all file system operations (e.g. "open c:\foo\bar.dll") go through this shim. This can be used to simulate a file system or project context when hosting the compiler in a very different logical context, e.g. in an application.

We should document how to this API as it is very important for many hosting situations.

SourceCodeServices: #r ignores include paths passed as command-line flags

The following code tests different ways to reference an assembly using various combinations of command-line and/or #-directives.

let test otherFlags sourceBeginning =
    let source = sourceBeginning + "open IntelliFactory.Core;;"
    let ic = InteractiveChecker.Create()
    let options = ic.GetProjectOptionsFromScript(@"C:\file.fsx", source, otherFlags = otherFlags)
    let parseResults = ic.ParseFileInProject(@"C:\file.fsx", source, options)
    match ic.CheckFileInProject(parseResults, @"C:\file.fsx", 1, source, options) |> Async.RunSynchronously with
    | CheckFileAnswer.Aborted -> ()
    | CheckFileAnswer.Succeeded checkResult ->
        printfn "%i errors." checkResult.Errors.Length
        for error in checkResult.Errors do
            printfn "%s" error.Message
        printfn ""

let asmname = "IntelliFactory.Core.dll"
let dirname = "c:/path/to/where/IntelliFactory.Core/is"

printfn "Using absolute -r:"
test [| sprintf "-r:%s/%s" dirname asmname |] ""

printfn "Using -I and relative -r:"
test [| sprintf "-I:%s" dirname; sprintf "-r:%s" asmname |] ""

printfn "Using -I and relative #r:"
test [| sprintf "-I:%s" dirname |] (sprintf """#r "%s";;""" asmname)

printfn "Using #i and relative #r:"
test [||] (sprintf """#I "%s";; #r "%s";;""" dirname asmname)

printfn "Using absolute #r:"
test [||] (sprintf """#r "%s/%s";;""" dirname asmname)

The output is:

Using absolute -r:
0 errors.

Using -I and relative -r:
0 errors.

Using -I and relative #r:
3 errors.
Assembly reference 'IntelliFactory.Core.dll' was not found or is invalid
Assembly reference 'IntelliFactory.Core.dll' was not found or is invalid
The namespace or module 'IntelliFactory' is not defined

Using #i and relative #r:
0 errors.

Using absolute #r:
0 errors.

As you can see, when passing the include directory via the command line and referencing the assembly via #r, the reference is not found.

This is of course inconsistent with fsi's behavior, which finds the reference correctly:

$ fsi -I:c:/path/to/where/IntelliFactory.Core/is --nologo <<EOF
> #r "IntelliFactory.Core.dll"
> open IntelliFactory.Core
> EOF

>
--> Referenced 'c:/path/to/where/IntelliFactory.Core/is\IntelliFactory.Core.dll'

$ 

Move to 1-based line counting throughout public API

FCS currently accepts and reports line numbers using a mix of zero-based (Line0, Pos01, Range01) and 1-based (pos, range) types.

I propose we remove the use of zero-based line numbers and use 1-based line numbers consistently throughout the API. MonoDevelop/XS and most other clients expect 1-based line counting.

It is not possible to normalize to 0-based line counting since 1-based line counnting is now revealed in the untyped syntax AST.

The biggest challenge is adjusting client code like GetDeclarations that accept an integer line number:

member GetDeclarations : ... * line: Line0 * ...

Here changing to line: int would not give a type error in client code. We could either make the change and list the places that people have to search for, or obsolete GetDeclarations, replacing it with:

member GetDeclarations1 : ... * line: int * ...

plus a nice warning on GetDeclarations saying you now have to use 1-based line counting, please adjust your code. The latter is probably safest given the growing number of clients of FCS.

Please add your comments about this below.

Expose typed ASTs and name resolution environment

Analysis and refactoring tools require deep understanding of F# types and name resolution. SourceCodeServices is good enough for editors, but too restrictive for the tools above.

It would be great to have name resolution (e.g. https://github.com/fsharp/FSharp.Compiler.Service/blob/master/src/fsharp/nameres.fsi#L85) and typed ASTs (as per https://github.com/fsharp/FSharp.Compiler.Service/blob/master/src/fsharp/tast.fs#L13) to be exposed. With this information, we don't have to reconstruct name resolution and type information by ourselves.

Does this make sense to do? I heard something to be done in this area, but I'm not sure what the agenda is.

Generating docs fails on osx

I get the following error when I execute the GenerateDocs target:

Finished Target: RunTests
Finished Target: All
Finished Target: PrepareRelease
Deleting contents of docs/output
Finished Target: CleanDocs
fsharpi --define:RELEASE generate.fsx
Copying file: /Users/dave/code/FSharp.Compiler.Service_/docs/output/.DS_Store
Copying file: /Users/dave/code/FSharp.Compiler.Service_/docs/output/images/logo.png
Copying styles and scripts: /Users/dave/code/FSharp.Compiler.Service_/docs/output/content/style.css
Copying styles and scripts: /Users/dave/code/FSharp.Compiler.Service_/docs/output/content/tips.js
Generating 'compiler.html'
System.Exception: Generating HTML failed.
  at Microsoft.FSharp.Core.Operators.FailWith[String] (System.String message) [0x00000] in <filename unknown>:0
  at FSharp.Literate.RazorRender.ProcessFile[IDictionary`2] (System.String source, Microsoft.FSharp.Core.FSharpOption`1 properties) [0x00000] in <filename unknown>:0
  at FSharp.Literate.Templating.generateFile (System.String contentTag, IEnumerable`1 parameters, Microsoft.FSharp.Core.FSharpOption`1 templateOpt, System.String output, IEnumerable`1 layoutRoots) [0x00000] in <filename unknown>:0
  at FSharp.Literate.Templating.processFile (FSharp.Literate.LiterateDocument doc, System.String output, FSharp.Literate.ProcessingContext ctx) [0x00000] in <filename unknown>:0
  at FSharp.Literate.Literate.ProcessScriptFile (System.String input, Microsoft.FSharp.Core.FSharpOption`1 templateFile, Microsoft.FSharp.Core.FSharpOption`1 output, Microsoft.FSharp.Core.FSharpOption`1 format, Microsoft.FSharp.Core.FSharpOption`1 formatAgent, Microsoft.FSharp.Core.FSharpOption`1 prefix, Microsoft.FSharp.Core.FSharpOption`1 compilerOptions, Microsoft.FSharp.Core.FSharpOption`1 lineNumbers, Microsoft.FSharp.Core.FSharpOption`1 references, Microsoft.FSharp.Core.FSharpOption`1 replacements, Microsoft.FSharp.Core.FSharpOption`1 includeSource, Microsoft.FSharp.Core.FSharpOption`1 layoutRoots) [0x00000] in <filename unknown>:0
  at <StartupCode$FSharp-Literate>[email protected] (System.String file, System.String output) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.FSharpFunc`2[System.String,System.String].InvokeFast[Unit] (Microsoft.FSharp.Core.FSharpFunc`2 func, System.String arg1, System.String arg2) [0x00000] in <filename unknown>:0
  at <StartupCode$FSharp-Literate>[email protected] (System.String indir, System.String outdir) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.FSharpFunc`2[System.String,System.String].InvokeFast[Unit] (Microsoft.FSharp.Core.FSharpFunc`2 func, System.String arg1, System.String arg2) [0x00000] in <filename unknown>:0
  at FSharp.Literate.Literate.ProcessDirectory (System.String inputDirectory, Microsoft.FSharp.Core.FSharpOption`1 templateFile, Microsoft.FSharp.Core.FSharpOption`1 outputDirectory, Microsoft.FSharp.Core.FSharpOption`1 format, Microsoft.FSharp.Core.FSharpOption`1 formatAgent, Microsoft.FSharp.Core.FSharpOption`1 prefix, Microsoft.FSharp.Core.FSharpOption`1 compilerOptions, Microsoft.FSharp.Core.FSharpOption`1 lineNumbers, Microsoft.FSharp.Core.FSharpOption`1 references, Microsoft.FSharp.Core.FSharpOption`1 replacements, Microsoft.FSharp.Core.FSharpOption`1 includeSource, Microsoft.FSharp.Core.FSharpOption`1 layoutRoots) [0x00000] in <filename unknown>:0
  at FSI_0002.buildDocumentation () [0x00000] in <filename unknown>:0
  at <StartupCode$FSI_0002>.$FSI_0002.main@ () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

Processing the file '/Users/dave/code/FSharp.Compiler.Service_/docs/tools/../../packages/FSharp.Formatting.2.3.4-beta/templates/docpage.cshtml' failed
Source written to: '/var/folders/5v/p_5h35nd70s8x7fh8fqn7hyh0000gn/T/tmp647f9dac.tmp.cs'
Compilation errors:
Stopped due to error

Duplicate symbol usage

Given the following example:

module Lists =

    let list1 = [ ]            /// an empty list

    let list2 = [ 1; 2; 3 ]    /// list of 3 elements

    let list3 = 42 :: list2    /// a new list with '42' added to the beginning

    let numberList = [ 1 .. 1000 ]  /// list of integers from 1 to 1000

    let fred = System.Text.StringBuilder()

module BoilerPlateForForm =
    [<System.STAThread>]
    do ()

If I ask for symbols at let fr§ed = System.Text.StringBuilder()

I get back two usages rather than the expected one:

Symbol display name: fred
Symbol range:   ("/Users/dave/Projects/tutorial/tutorial/Tutorial.fs", ((10, 8), (10, 12)))
Symbol usage:   ("/Users/dave/Projects/tutorial/tutorial/Tutorial.fs", ((10, 8), (10, 12)))

Check for originating project/assembly of a symbol

With recently added multi-project analysis, it would be great if we are able to check which assembly/project a symbol is declared.

This information enables us to analyze projects more efficiently without resorting to analyzing all projects every time.

Eliminate global mutable state.

Much of the compiler code base currently relies on global mutable state. This comes with the following implications:

  • It is impossible to effectively parallelize calls to the service without sacrificing thread safety.
  • The service is not referentially transparent: identical inputs might generate slightly different assemblies, most importantly yielding incompatible names in generated closure types. This can be a serious problem when considering things like serialization.

We should improve this situation, either by making global mutable state thread safe or even completely refactoring the relevant code so that it becomes referentially transparent.

An FSharpEntity retrieved from an FSharpMemberFunctionOrValue.EnclosingEntity has no Assembly details but the symbol itself does.

Given a snippet thats matching a FSharpSymbol:

match fsSymbol with 
...
        // Members, Module-defined functions and Module-definned values
        | :? FSharpMemberFunctionOrValue as fsMember when fsMember.IsModuleValueOrMember -> 
           let fsEntity = fsMember.EnclosingEntity
           let assemblyFilename = match fsEntity.Assembly.FileName with None -> "" | Some
...

The fsEntity.Assembly.FileName will be None, but `fsSymbol.Assembly.FileName will be Some.

Is that expected?

Analyzing code causes a stack overflow

Moving this issue here: fsprojects/zarchive-fsharpbinding#303

Analysing the code below caused a problem in Xamarin Studio

let ratherlongfunction(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) = 
    a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z

let ratherlongfunction2 a b c d e f g h i j k l m n o p q r s t u v w x y z = 
    a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z

System.InvalidOperationException : not a named type

Running the unit tests for F# Formatting currently gives the following error (see travis log):

Errors and Failures:
1) Test Error : FSharp.MetadataFormat.Tests.MetadataFormat works on sample Deedle assembly
   System.InvalidOperationException : not a named type
  at <StartupCode$FSharp-Compiler-Service>[email protected] (Microsoft.FSharp.Core.Unit unitVar0) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.SourceCodeServices.Impl.protect[FSharpEntity] (Microsoft.FSharp.Core.FSharpFunc`2 f) [0x00000] in <filename unknown>:0 

I believe this used to work in the earlier version - do we need to change something somewhere in F# Formatting?

Support multi-project analysis

It would provide the basis to bring cross-F#-project rename refactoring and find all references to Xamarin Studio and Visual Studio.

We can use single-project analysis, resolve project dependencies and recompile everything as a workaround. However, it loses incrementality property which is a must for the scale of multi-project analysis.

Find also .exe assemblies in the search path

Trying to run fsformatting.exe on our project, some assemblies were not properly resolved. After debugging, I found out, that the assembly search paths are in fact correctly passed to the InteractiveChecker.

But as it turns out, the assemblies that could not be resolved are all .exe assemblies, which hints towards not fully implemented assembly resolving in the interactive checker or somewhere else in FSharp.Compiler.Service

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.