Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate visualfsharp master #856

Merged
merged 5 commits into from
Mar 28, 2018
Merged
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
1 change: 1 addition & 0 deletions PublishToBlob.proj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Import Project="$(MSBuildThisFileDirectory)packages\$(FeedTasksPackage).$(FeedTasksPackageVersion)\build\$(FeedTasksPackage).targets" />

<ItemGroup>
<!-- this should pick up both *.nupkg and *.symbols.nupkg -->
<NuGetPackages Include="$(MSBuildThisFileDirectory)artifacts\Microsoft.FSharp.Compiler.*.nupkg" />
</ItemGroup>

Expand Down
20 changes: 10 additions & 10 deletions fcs/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@


# The FSharp.Compiler.Service components and nuget package
# The FSharp.Compiler.Service components and NuGet package

This directory contains the build, packaging, test and documentation-generation logic for the nuget package ``FSharp.Compiler.Service``. The source for this nuget
This directory contains the build, packaging, test and documentation-generation logic for the NuGet package ``FSharp.Compiler.Service``. The source for this NuGet
package is in ``..\src``.

Basically we are packaging up the compiler as a DLL and publishing it as a nuget package.
Basically we are packaging up the compiler as a DLL and publishing it as a NuGet package.

## FSharp.Compiler.Service v. FSharp.Compiler.Private

There are subtle differences between FSharp.Compiler.Service and FSharp.Compiler.Private (shipped with the Visual F# Tools)

- FCS has a public API
- FCS is built against **.NET 4.5** and **FSharp.Core 4.0.0.0** to give broader reach
- FCS has a Nuget package
- FCS has a NuGet package
- FCS has a .NET Standard 1.6 version in the nuget package
- FCS testing also tests the "Project Cracker" (see below)
- FCS doesn't add the System.ValueTuple.dll reference by default, see ``#if COMPILER_SERVICE_AS_DLL`` in compiler codebase
Expand Down Expand Up @@ -57,17 +57,17 @@ which does things like:

### Manual push of packages

Yu can push the packages if you have permissions, either automatically using ``build Release`` or manually
You can push the packages if you have permissions, either automatically using ``build Release`` or manually

set APIKEY=...
..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.22.0.2.nupkg %APIKEY% -Source https://nuget.org
..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.MSBuild.v12.22.0.2.nupkg %APIKEY% -Source https://nuget.org
..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.ProjectCracker.22.0.2.nupkg %APIKEY% -Source https://nuget.org
..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.22.0.3.nupkg %APIKEY% -Source https://nuget.org
..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.MSBuild.v12.22.0.3.nupkg %APIKEY% -Source https://nuget.org
..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.ProjectCracker.22.0.3.nupkg %APIKEY% -Source https://nuget.org


### Use of Paket and FAKE

Paket is only used to get fake and formating tools. Eventually we will likely remove this once we update the project files to .NET SDK 2.0.
Paket is only used to get FAKE and FSharp.Formatting tools. Eventually we will likely remove this once we update the project files to .NET SDK 2.0.

FAKE is only used to run build.fsx. Eventually we will likely remove this once we update the project files to .NET SDK 2.0.

Expand All @@ -83,7 +83,7 @@ Testing reuses the test files from ..\tests\service which were are also FCS test
Output is in ``docs``. In the ``FSharp.Compiler.Service`` repo this is checked in and hosted as http://fsharp.github.io/FSharp.Compiler.Service.


## The two other nuget packages
## The two other NuGet packages

It also contains both the source, build, packaging and test logic for

Expand Down
3 changes: 3 additions & 0 deletions fcs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 22.0.3
* [Add entity.DeclaringEntity](https://github.com/Microsoft/visualfsharp/pull/4633), [FCS feature request](https://github.com/fsharp/FSharp.Compiler.Service/issues/830)

#### 22.0.2
* Use correct version number in DLLs (needed until https://github.com/Microsoft/visualfsharp/issues/3113 is fixed)

Expand Down
2 changes: 1 addition & 1 deletion fcs/fcs.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>

<VersionPrefix>22.0.2</VersionPrefix>
<VersionPrefix>22.0.3</VersionPrefix>
<OtherFlags>--version:$(VersionPrefix)</OtherFlags>
<!-- FSharp.Compiler.Tools is currently only used to get a working FSI.EXE to execute some scripts during the build -->
<!-- The LKG FSI.EXE requires MSBuild 15 to be installed, which is painful -->
Expand Down
55 changes: 24 additions & 31 deletions src/absil/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ type ILAssemblyRef(data) =

ILAssemblyRef.Create(aname.Name,None,publicKey,retargetable,version,locale)



member aref.QualifiedName =
let b = new System.Text.StringBuilder(100)
let add (s:string) = (b.Append(s) |> ignore)
Expand Down Expand Up @@ -478,13 +476,6 @@ type ILScopeRef =
member x.AssemblyRef = match x with ILScopeRef.Assembly x -> x | _ -> failwith "not an assembly reference"

member scoref.QualifiedName =
match scoref with
| ILScopeRef.Local -> ""
| ILScopeRef.Module mref -> "module "^mref.Name
| ILScopeRef.Assembly aref when aref.Name = "mscorlib" -> ""
| ILScopeRef.Assembly aref -> aref.QualifiedName

member scoref.QualifiedNameWithNoShortPrimaryAssembly =
match scoref with
| ILScopeRef.Local -> ""
| ILScopeRef.Module mref -> "module "+mref.Name
Expand Down Expand Up @@ -602,18 +593,12 @@ type ILTypeRef =
member tref.BasicQualifiedName =
(String.concat "+" (tref.Enclosing @ [ tref.Name ] )).Replace(",", @"\,")

member tref.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(basic) =
let sco = tref.Scope.QualifiedNameWithNoShortPrimaryAssembly
if sco = "" then basic else String.concat ", " [basic;sco]

member tref.QualifiedNameWithNoShortPrimaryAssembly =
tref.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(tref.BasicQualifiedName)

member tref.QualifiedName =
let basic = tref.BasicQualifiedName
member tref.AddQualifiedNameExtension(basic) =
let sco = tref.Scope.QualifiedName
if sco = "" then basic else String.concat ", " [basic;sco]

member tref.QualifiedName =
tref.AddQualifiedNameExtension(tref.BasicQualifiedName)

override x.ToString() = x.FullName

Expand All @@ -624,22 +609,30 @@ and
{ tspecTypeRef: ILTypeRef;
/// The type instantiation if the type is generic.
tspecInst: ILGenericArgs }

member x.TypeRef=x.tspecTypeRef

member x.Scope=x.TypeRef.Scope

member x.Enclosing=x.TypeRef.Enclosing

member x.Name=x.TypeRef.Name

member x.GenericArgs=x.tspecInst

static member Create(tref,inst) = { tspecTypeRef =tref; tspecInst=inst }

override x.ToString() = x.TypeRef.ToString() + if isNil x.GenericArgs then "" else "<...>"

member x.BasicQualifiedName =
let tc = x.TypeRef.BasicQualifiedName
if isNil x.GenericArgs then
tc
else
tc + "[" + String.concat "," (x.GenericArgs |> List.map (fun arg -> "[" + arg.QualifiedNameWithNoShortPrimaryAssembly + "]")) + "]"
tc + "[" + String.concat "," (x.GenericArgs |> List.map (fun arg -> "[" + arg.QualifiedName + "]")) + "]"

member x.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(basic) =
x.TypeRef.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(basic)
member x.AddQualifiedNameExtension(basic) =
x.TypeRef.AddQualifiedNameExtension(basic)

member x.FullName=x.TypeRef.FullName

Expand All @@ -666,19 +659,19 @@ and [<RequireQualifiedAccess; StructuralEquality; StructuralComparison>]
| ILType.Byref _ty -> failwith "unexpected byref type"
| ILType.FunctionPointer _mref -> failwith "unexpected function pointer type"

member x.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(basic) =
member x.AddQualifiedNameExtension(basic) =
match x with
| ILType.TypeVar _n -> basic
| ILType.Modified(_,_ty1,ty2) -> ty2.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(basic)
| ILType.Array (ILArrayShape(_s),ty) -> ty.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(basic)
| ILType.Value tr | ILType.Boxed tr -> tr.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(basic)
| ILType.Modified(_,_ty1,ty2) -> ty2.AddQualifiedNameExtension(basic)
| ILType.Array (ILArrayShape(_s),ty) -> ty.AddQualifiedNameExtension(basic)
| ILType.Value tr | ILType.Boxed tr -> tr.AddQualifiedNameExtension(basic)
| ILType.Void -> failwith "void"
| ILType.Ptr _ty -> failwith "unexpected pointer type"
| ILType.Byref _ty -> failwith "unexpected byref type"
| ILType.FunctionPointer _mref -> failwith "unexpected function pointer type"

member x.QualifiedNameWithNoShortPrimaryAssembly =
x.AddQualifiedNameExtensionWithNoShortPrimaryAssembly(x.BasicQualifiedName)
member x.QualifiedName =
x.AddQualifiedNameExtension(x.BasicQualifiedName)

member x.TypeSpec =
match x with
Expand Down Expand Up @@ -3301,7 +3294,7 @@ let rec encodeCustomAttrElemType x =
| ILType.Boxed tspec when tspec.Name = tname_String -> [| et_STRING |]
| ILType.Boxed tspec when tspec.Name = tname_Object -> [| 0x51uy |]
| ILType.Boxed tspec when tspec.Name = tname_Type -> [| 0x50uy |]
| ILType.Value tspec -> Array.append [| 0x55uy |] (encodeCustomAttrString tspec.TypeRef.QualifiedNameWithNoShortPrimaryAssembly)
| ILType.Value tspec -> Array.append [| 0x55uy |] (encodeCustomAttrString tspec.TypeRef.QualifiedName)
| ILType.Array (shape, elemType) when shape = ILArrayShape.SingleDimensional ->
Array.append [| et_SZARRAY |] (encodeCustomAttrElemType elemType)
| _ -> failwith "encodeCustomAttrElemType: unrecognized custom element type"
Expand Down Expand Up @@ -3372,8 +3365,8 @@ let rec encodeCustomAttrPrimValue ilg c =
| ILAttribElem.UInt64 x -> u64AsBytes x
| ILAttribElem.Single x -> ieee32AsBytes x
| ILAttribElem.Double x -> ieee64AsBytes x
| ILAttribElem.Type (Some ty) -> encodeCustomAttrString ty.QualifiedNameWithNoShortPrimaryAssembly
| ILAttribElem.TypeRef (Some tref) -> encodeCustomAttrString tref.QualifiedNameWithNoShortPrimaryAssembly
| ILAttribElem.Type (Some ty) -> encodeCustomAttrString ty.QualifiedName
| ILAttribElem.TypeRef (Some tref) -> encodeCustomAttrString tref.QualifiedName
| ILAttribElem.Array (_,elems) ->
[| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrPrimValue ilg elem |]

Expand Down Expand Up @@ -3427,7 +3420,7 @@ let mkPermissionSet (ilg: ILGlobals) (action,attributes: list<(ILTypeRef * (stri
[| yield (byte '.');
yield! z_unsigned_int attributes.Length;
for (tref:ILTypeRef,props) in attributes do
yield! encodeCustomAttrString tref.QualifiedNameWithNoShortPrimaryAssembly
yield! encodeCustomAttrString tref.QualifiedName
let bytes =
[| yield! z_unsigned_int props.Length;
for (nm,typ,value) in props do
Expand Down
42 changes: 37 additions & 5 deletions src/absil/il.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -184,26 +184,32 @@ type ILTypeRef =

member QualifiedName: string

#if !NO_EXTENSIONTYPING
member QualifiedNameWithNoShortPrimaryAssembly: string
#endif

interface System.IComparable

/// Type specs and types.
[<Sealed>]
type ILTypeSpec =
/// Create an ILTypeSpec.
static member Create: typeRef:ILTypeRef * instantiation:ILGenericArgs -> ILTypeSpec

/// Which type is being referred to?
member TypeRef: ILTypeRef

/// The type instantiation if the type is generic, otherwise empty
member GenericArgs: ILGenericArgs

/// Where is the type, i.e. is it in this module, in another module in this assembly or in another assembly?
member Scope: ILScopeRef

/// The list of enclosing type names for a nested type. If non-nil then the first of these also contains the namespace.
member Enclosing: string list

/// The name of the type. This also contains the namespace if Enclosing is empty.
member Name: string

/// The name of the type in the assembly using the '.' notation for nested types.
member FullName: string

interface System.IComparable

and
Expand Down Expand Up @@ -244,13 +250,20 @@ and
ILType

member TypeSpec: ILTypeSpec

member Boxity: ILBoxity

member TypeRef: ILTypeRef

member IsNominal: bool

member GenericArgs: ILGenericArgs

member IsTyvar: bool

member BasicQualifiedName: string
member QualifiedNameWithNoShortPrimaryAssembly: string

member QualifiedName: string

and [<StructuralEquality; StructuralComparison>]
ILCallingSignature =
Expand All @@ -271,13 +284,21 @@ type ILMethodRef =
static member Create: enclosingTypeRef: ILTypeRef * callingConv: ILCallingConv * name: string * genericArity: int * argTypes: ILTypes * returnType: ILType -> ILMethodRef

member DeclaringTypeRef: ILTypeRef

member CallingConv: ILCallingConv

member Name: string

member GenericArity: int

member ArgCount: int

member ArgTypes: ILTypes

member ReturnType: ILType

member CallingSignature: ILCallingSignature

interface System.IComparable

/// Formal identities of fields.
Expand All @@ -295,13 +316,21 @@ type ILMethodSpec =
static member Create: ILType * ILMethodRef * ILGenericArgs -> ILMethodSpec

member MethodRef: ILMethodRef

member DeclaringType: ILType

member GenericArgs: ILGenericArgs

member CallingConv: ILCallingConv

member GenericArity: int

member Name: string

member FormalArgTypes: ILTypes

member FormalReturnType: ILType

interface System.IComparable

/// Field specs. The data given for a ldfld, stfld etc. instruction.
Expand All @@ -311,8 +340,11 @@ type ILFieldSpec =
DeclaringType: ILType }

member DeclaringTypeRef: ILTypeRef

member Name: string

member FormalType: ILType

member ActualType: ILType

/// ILCode labels. In structured code each code label refers to a basic block somewhere in the code of the method.
Expand Down
Loading