Skip to content

Commit f421101

Browse files
author
Omar Tawfik
committed
Merge branch 'master' of https://github.com/Microsoft/visualfsharp into roslyn
2 parents 263d97b + f97dcf6 commit f421101

36 files changed

+1164
-1347
lines changed

DEVGUIDE.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ There are various qualifiers:
5050
build.cmd test-fsharpqa -- build, run tests\fsharpqa suite
5151
build.cmd test-vs -- build, run Visual F# IDE Tools unit tests
5252

53+
**Notes**
54+
To build and test Visual F# IDE Tools, you must use [Visual Studio "vNext" (aka "Dev15")](https://www.visualstudio.com/en-us/downloads/visual-studio-next-downloads-vs.aspx). This is the one after Visual Studio 2015 (aka "Dev 14"). You must also install Visual Studio SDK (also called _Visual Studio Extensibility SDK_ on the Visual Studio installer) before building Visual F# IDE Tools.
55+
Please ensure that the Visual Studio SDK version is matched with your current Visual Studio to ensure successful builds. For example: Visual Studio 2015 Update 1 requires Visual Studio 2015 SDK Update 1. Any installation of Visual Studio 2015 and later provides Visual Studio SDK as part of the installation of Visual Studio 2015 as feature installation.
56+
5357
Combinations are also allowed:
5458

5559
build.cmd debug,compiler,notests -- build the debug compiler and run smoke tests
@@ -147,8 +151,13 @@ For **Release** this corresponds to these steps, which you can run individually
147151

148152
### 4. [Optional] Install the Visual F# IDE Tools
149153

150-
**Note:** This step will install a VSIX extension into Visual Studio 15 that changes the Visual F# IDE Tools
151-
components installed into Visual Studio 15. You can revert this step by disabling or uninstalling the addin.
154+
At time of writing, the Visual F# IDE Tools can only be installed into Visual Studio "Next" (aka "Dev15") releases.
155+
The new builds of the Visual F# IDE Tools can no longer be installed into Visual Studio 2015.
156+
157+
You can install VIsual Studio "Next (aka "Dev15") from https://www.visualstudio.com/en-us/downloads/visual-studio-next-downloads-vs.aspx.
158+
159+
**Note:** This step will install a VSIX extension into Visual Studio "Next" (aka "Dev15") that changes the Visual F# IDE Tools
160+
components installed in that VS installation. You can revert this step by disabling or uninstalling the addin.
152161

153162
For **Debug**:
154163

VisualFSharp.sln

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
128128
EndProjectSection
129129
EndProject
130130
Global
131-
GlobalSection(Performance) = preSolution
132-
HasPerformanceSessions = true
133-
EndGlobalSection
134131
GlobalSection(SolutionConfigurationPlatforms) = preSolution
135132
Debug|Any CPU = Debug|Any CPU
136133
Debug|x86 = Debug|x86

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
os: Visual Studio 2015
2-
2+
33
environment:
44
matrix:
55
- BUILD_PROFILE: ci_part1

build.cmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ if /i '%ARG%' == 'ci' (
141141
set CONF_FSHARPQA_SUITE=Smoke
142142
)
143143

144-
REM These divide 'ci' into three chunks which can be done in parallel
144+
145+
REM These divide 'ci' into two chunks which can be done in parallel
145146
if /i '%ARG%' == 'ci_part1' (
146147
set BUILD_PROTO=1
147148
set SKIP_EXPENSIVE_TESTS=1

src/absil/ildiag.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
77
open Internal.Utilities
88

99
let diagnosticsLog = ref (Some stdout)
10+
11+
let setDiagnosticsChannel s = diagnosticsLog := s
12+
1013
let dflushn () = match !diagnosticsLog with None -> () | Some d -> d.WriteLine(); d.Flush()
1114
let dflush () = match !diagnosticsLog with None -> () | Some d -> d.Flush()
1215
let dprintn (s:string) =
@@ -18,4 +21,3 @@ let dprintf (fmt: Format<_,_,_,_>) =
1821
let dprintfn (fmt: Format<_,_,_,_>) =
1922
Printf.kfprintf dflushn (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt
2023

21-
let setDiagnosticsChannel s = diagnosticsLog := s

src/absil/ildiag.fsi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
1111
open System.IO
1212
open Microsoft.FSharp.Core.Printf
1313

14-
val public setDiagnosticsChannel: TextWriter option -> unit
14+
val public setDiagnosticsChannel: TextWriter option -> unit
1515

1616
val public dprintfn: TextWriterFormat<'a> -> 'a
1717
val public dprintf: TextWriterFormat<'a> -> 'a
18-
1918
val public dprintn: string -> unit

src/absil/ilread.fs

Lines changed: 784 additions & 797 deletions
Large diffs are not rendered by default.

src/fsharp/CompileOps.fs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,10 +1476,10 @@ let CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorS
14761476

14771477
match err.Exception with
14781478
| ReportedError _ ->
1479-
dprintf "Unexpected ReportedError" (* this should actually never happen *)
1479+
assert ("" = "Unexpected ReportedError") // this should never happen
14801480
Seq.empty
14811481
| StopProcessing ->
1482-
dprintf "Unexpected StopProcessing" (* this should actually never happen *)
1482+
assert ("" = "Unexpected StopProcessing") // this should never happen
14831483
Seq.empty
14841484
| _ ->
14851485
let errors = ResizeArray()
@@ -2962,6 +2962,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
29622962
let logmessage showMessages =
29632963
if showMessages && tcConfig.showReferenceResolutions then (fun (message:string)->dprintf "%s\n" message)
29642964
else ignore
2965+
29652966
let logwarning showMessages =
29662967
(fun code message->
29672968
if showMessages && mode = ReportErrors then
@@ -2975,6 +2976,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
29752976
| _ ->
29762977
(if code = "MSB3245" then errorR else warning)
29772978
(MSBuildReferenceResolutionWarning(code,message,errorAndWarningRange)))
2979+
29782980
let logerror showMessages =
29792981
(fun code message ->
29802982
if showMessages && mode = ReportErrors then
@@ -2988,10 +2990,12 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
29882990
| Some(X86) -> "x86"
29892991
| Some(AMD64) -> "amd64"
29902992
| Some(IA64) -> "ia64"
2993+
29912994
let outputDirectory =
29922995
match tcConfig.outputFile with
29932996
| Some(outputFile) -> tcConfig.MakePathAbsolute outputFile
29942997
| None -> tcConfig.implicitIncludeDir
2998+
29952999
let targetFrameworkDirectories =
29963000
match tcConfig.clrRoot with
29973001
| Some(clrRoot) -> [tcConfig.MakePathAbsolute clrRoot]
@@ -3033,6 +3037,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
30333037
|> Array.map(fun i->(p13 groupedReferences.[i]),(p23 groupedReferences.[i]),i)
30343038
|> Array.filter (fun (_,i0,_)->resolvedAsFile|>Array.exists(fun (i1,_) -> i0=i1)|>not)
30353039
|> Array.map(fun (ref,_,i)->ref,string i)
3040+
30363041
let resolutions = Resolve(toMsBuild,(*showMessages*)true)
30373042

30383043
// Map back to original assembly resolutions.

src/fsharp/ConstraintSolver.fs

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -160,44 +160,45 @@ type TcValF = (ValRef -> ValUseFlag -> TType list -> range -> Expr * TType)
160160

161161
type ConstraintSolverState =
162162
{
163-
g: TcGlobals;
164-
amap: Import.ImportMap;
165-
InfoReader : InfoReader;
163+
g: TcGlobals
164+
amap: Import.ImportMap
165+
InfoReader : InfoReader
166166
TcVal : TcValF
167167
/// This table stores all unsolved, ungeneralized trait constraints, indexed by free type variable.
168168
/// That is, there will be one entry in this table for each free type variable in
169169
/// each outstanding, unsolved, ungeneralized trait constraint. Constraints are removed from the table and resolved
170170
/// each time a solution to an index variable is found.
171-
mutable ExtraCxs: HashMultiMap<Stamp, (TraitConstraintInfo * range)>;
171+
mutable ExtraCxs: HashMultiMap<Stamp, (TraitConstraintInfo * range)>
172172
}
173173

174174
static member New(g,amap,infoReader, tcVal) =
175-
{ g=g; amap=amap;
175+
{ g=g
176+
amap=amap
176177
ExtraCxs= HashMultiMap(10, HashIdentity.Structural)
177178
InfoReader=infoReader
178-
TcVal = tcVal } ;
179+
TcVal = tcVal }
179180

180181

181182
type ConstraintSolverEnv =
182183
{
183-
SolverState: ConstraintSolverState;
184+
SolverState: ConstraintSolverState
184185
eContextInfo: ContextInfo
185186
MatchingOnly : bool
186-
m: range;
187-
EquivEnv: TypeEquivEnv;
187+
m: range
188+
EquivEnv: TypeEquivEnv
188189
DisplayEnv : DisplayEnv
189190
}
190191
member csenv.InfoReader = csenv.SolverState.InfoReader
191192
member csenv.g = csenv.SolverState.g
192193
member csenv.amap = csenv.SolverState.amap
193194

194195
let MakeConstraintSolverEnv contextInfo css m denv =
195-
{ SolverState=css;
196-
m=m;
196+
{ SolverState=css
197+
m=m
197198
eContextInfo = contextInfo
198199
// Indicates that when unifiying ty1 = ty2, only type variables in ty1 may be solved
199-
MatchingOnly=false;
200-
EquivEnv=TypeEquivEnv.Empty;
200+
MatchingOnly=false
201+
EquivEnv=TypeEquivEnv.Empty
201202
DisplayEnv = denv }
202203

203204

@@ -303,9 +304,10 @@ let BakedInTraitConstraintNames =
303304
// Run the constraint solver with undo (used during method overload resolution)
304305

305306
type Trace =
306-
| Trace of (unit -> unit) list ref
307-
static member New () = Trace (ref [])
308-
member t.Undo () = let (Trace trace) = t in List.iter (fun a -> a ()) !trace
307+
{ mutable actions: (unit -> unit) list }
308+
static member New () = { actions = [] }
309+
member t.Undo () = List.iter (fun a -> a ()) t.actions
310+
member t.Push f = t.actions <- f :: t.actions
309311

310312
type OptionalTrace =
311313
| NoTrace
@@ -417,7 +419,7 @@ let rec TransactStaticReq (csenv:ConstraintSolverEnv) trace (tpr:Typar) req =
417419
let orig = tpr.StaticReq
418420
match trace with
419421
| NoTrace -> ()
420-
| WithTrace (Trace actions) -> actions := (fun () -> tpr.SetStaticReq orig) :: !actions
422+
| WithTrace trace -> trace.Push (fun () -> tpr.SetStaticReq orig)
421423
tpr.SetStaticReq req;
422424
CompleteD
423425

@@ -446,7 +448,7 @@ let rec TransactDynamicReq trace (tpr:Typar) req =
446448
let orig = tpr.DynamicReq
447449
match trace with
448450
| NoTrace -> ()
449-
| WithTrace (Trace actions) -> actions := (fun () -> tpr.SetDynamicReq orig) :: !actions
451+
| WithTrace trace -> trace.Push (fun () -> tpr.SetDynamicReq orig)
450452
tpr.SetDynamicReq req;
451453
CompleteD
452454

@@ -673,7 +675,7 @@ let rec SolveTyparEqualsTyp (csenv:ConstraintSolverEnv) ndeep m2 trace ty1 ty =
673675
let tpdata = r.Data
674676
match trace with
675677
| NoTrace -> ()
676-
| WithTrace (Trace actions) -> actions := (fun () -> tpdata.typar_solution <- None) :: !actions
678+
| WithTrace trace -> trace.Push (fun () -> tpdata.typar_solution <- None)
677679
tpdata.typar_solution <- Some ty;
678680

679681
(* dprintf "setting typar %d to type %s at %a\n" r.Stamp ((DebugPrint.showType ty)) outputRange m; *)
@@ -1343,7 +1345,7 @@ and TransactMemberConstraintSolution traitInfo trace sln =
13431345
traitInfo.Solution <- Some sln
13441346
match trace with
13451347
| NoTrace -> ()
1346-
| WithTrace (Trace actions) -> actions := (fun () -> traitInfo.Solution <- prev) :: !actions
1348+
| WithTrace trace -> trace.Push (fun () -> traitInfo.Solution <- prev)
13471349

13481350
/// Only consider overload resolution if canonicalizing or all the types are now nominal.
13491351
/// That is, don't perform resolution if more nominal information may influence the set of available overloads
@@ -1410,7 +1412,7 @@ and SolveRelevantMemberConstraintsForTypar (csenv:ConstraintSolverEnv) ndeep per
14101412

14111413
match trace with
14121414
| NoTrace -> ()
1413-
| WithTrace (Trace actions) -> actions := (fun () -> cxs |> List.iter (fun cx -> cxst.Add(tpn,cx))) :: !actions
1415+
| WithTrace trace -> trace.Push (fun () -> cxs |> List.iter (fun cx -> cxst.Add(tpn,cx)))
14141416

14151417
cxs |> AtLeastOneD (fun (traitInfo,m2) ->
14161418
let csenv = { csenv with m = m2 }
@@ -1437,7 +1439,7 @@ and AddMemberConstraint (csenv:ConstraintSolverEnv) ndeep m2 trace traitInfo sup
14371439
if not (cxs |> List.exists (fun (traitInfo2,_) -> traitsAEquiv g aenv traitInfo traitInfo2)) then
14381440
match trace with
14391441
| NoTrace -> ()
1440-
| WithTrace (Trace actions) -> actions := (fun () -> csenv.SolverState.ExtraCxs.Remove tpn) :: !actions
1442+
| WithTrace trace -> trace.Push (fun () -> csenv.SolverState.ExtraCxs.Remove tpn)
14411443
csenv.SolverState.ExtraCxs.Add (tpn,(traitInfo,m2))
14421444
);
14431445

@@ -1613,7 +1615,7 @@ and AddConstraint (csenv:ConstraintSolverEnv) ndeep m2 trace tp newConstraint =
16131615
let orig = d.typar_constraints
16141616
begin match trace with
16151617
| NoTrace -> ()
1616-
| WithTrace (Trace actions) -> actions := (fun () -> d.typar_constraints <- orig) :: !actions
1618+
| WithTrace trace -> trace.Push (fun () -> d.typar_constraints <- orig)
16171619
end;
16181620
d.typar_constraints <- newConstraints;
16191621

@@ -1922,11 +1924,6 @@ and CanMemberSigsMatchUpToCheck
19221924
//-------------------------------------------------------------------------
19231925

19241926

1925-
and private DefinitelyEquiv (csenv:ConstraintSolverEnv) isConstraint calledArg (CallerArg(callerArgTy,m,_,_) as callerArg) =
1926-
let calledArgTy = AdjustCalledArgType csenv.InfoReader isConstraint calledArg callerArg
1927-
if not (typeEquiv csenv.g calledArgTy callerArgTy) then ErrorD(Error(FSComp.SR.csArgumentTypesDoNotMatch(),m)) else
1928-
CompleteD
1929-
19301927
// Assert a subtype constraint, and wrap an ErrorsFromAddingSubsumptionConstraint error around any failure
19311928
// to allow us to report the outer types involved in the constraint
19321929
and private SolveTypSubsumesTypWithReport (csenv:ConstraintSolverEnv) ndeep m trace ty1 ty2 =
@@ -2409,7 +2406,7 @@ let EliminateConstraintsForGeneralizedTypars csenv trace (generalizedTypars: Typ
24092406
cxst.Remove tpn;
24102407
match trace with
24112408
| NoTrace -> ()
2412-
| WithTrace (Trace actions) -> actions := (fun () -> (csenv.SolverState.ExtraCxs.Add (tpn,cx))) :: !actions)
2409+
| WithTrace trace -> trace.Push (fun () -> (csenv.SolverState.ExtraCxs.Add (tpn,cx))))
24132410
)
24142411

24152412

src/fsharp/ConstraintSolver.fsi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ val BakedInTraitConstraintNames : string list
9898

9999
val MakeConstraintSolverEnv : ContextInfo -> ConstraintSolverState -> range -> DisplayEnv -> ConstraintSolverEnv
100100

101-
type Trace = Trace of (unit -> unit) list ref
101+
[<Sealed; NoEquality; NoComparison>]
102+
type Trace
102103

103104
type OptionalTrace =
104105
| NoTrace

0 commit comments

Comments
 (0)