Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.fsx
  • Loading branch information
jindraivanek committed Feb 18, 2019
2 parents 4f2e754 + fb1fba0 commit 2090601
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 11 deletions.
19 changes: 19 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#### 2.9.2 - 02-2019
* Fix PreserveEndOfLine introduces additional newlines. [#360](https://github.com/fsprojects/fantomas/issues/360)
* Fix Extra newline is introduced when file ends with multiline comment. [#363](https://github.com/fsprojects/fantomas/issues/363)
* Fix Fantomas shouldn't remove parens when using the dynamic operator (?). [#369](https://github.com/fsprojects/fantomas/issues/369)
* Fix Extra semicolons in list with PreserveEndOfLine. [#371](https://github.com/fsprojects/fantomas/issues/371)
* Use qualified name for inputPath and outputPath. [#376](https://github.com/fsprojects/fantomas/pull/376)
* Added Nightly nuget feed. [#375](https://github.com/fsprojects/fantomas/pull/375)
* Moved solution file to root folder. [#377](https://github.com/fsprojects/fantomas/pull/377)
* Fix Multiple attributes indented wrongly with PreserveEndOfLine. [#370](https://github.com/fsprojects/fantomas/issues/370)
* Fix pattern matched unions are formatted badly. [#283](https://github.com/fsprojects/fantomas/issues/283)
* Fix wrong indentation when accessing member of constructed record. [#383](https://github.com/fsprojects/fantomas/issues/383)
* Fix latest fantomas breaks Falanx indentation. [#384](https://github.com/fsprojects/fantomas/issues/384)
* Add support for SynExpr.Set(_,_,_). [#368](https://github.com/fsprojects/fantomas/issues/368)
* Fix Recurse option with globally installed dotnet-tool traverses 'obj' directories. [#341](https://github.com/fsprojects/fantomas/issues/341)
* Fix creates invalid F# for string handling operations. [#365](https://github.com/fsprojects/fantomas/issues/365)
* Use FAKE 5. [#261](https://github.com/fsprojects/fantomas/issues/261)
* Added FAKE 5 sample. [#402](https://github.com/fsprojects/fantomas/issues/402)


#### 2.9.1 - 11-2018
* Added instructions for vscode and online website. [#333](https://github.com/fsprojects/fantomas/pull/333)
* Removed trailing spaces for each line, after formatting. [#328](https://github.com/fsprojects/fantomas/issues/328)
Expand Down
16 changes: 8 additions & 8 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type ExternalProjectInfo =
let configureBuildCommandFromFakeBuildScripts scriptPrefix argument pathToProject =
if Environment.isWindows
then { ProcessName = Path.combine pathToProject (sprintf "%s.cmd" scriptPrefix); Arguments = [ argument ] }
else { ProcessName = "sh"; Arguments = [ sprintf "%s/%s.sh %s" pathToProject scriptPrefix argument ] }
else { ProcessName = "sh"; Arguments = [ sprintf "%s/%s.sh" pathToProject scriptPrefix; argument ] }
let configureBuildCommandFromDefaultFakeBuildScripts pathToProject =
configureBuildCommandFromFakeBuildScripts "build" "Build" pathToProject

Expand All @@ -94,8 +94,8 @@ let configureBuildCommandDotnetBuild pathToProject =
let fantomasExecutableForExternalTests projectdir =
let configuration =
match configuration with
| DotNet.BuildConfiguration.Debug -> "debug"
| DotNet.BuildConfiguration.Release -> "release"
| DotNet.BuildConfiguration.Debug -> "Debug"
| DotNet.BuildConfiguration.Release -> "Release"
| DotNet.BuildConfiguration.Custom s -> s

if Environment.isWindows
Expand All @@ -108,11 +108,6 @@ let externalProjectsToTest = [
Tag = "5.1.0"
SourceSubDirectory = "src"
BuildConfigurationFn = configureBuildCommandFromDefaultFakeBuildScripts }
{ GitUrl = @"https://github.com/MangelMaxime/fulma-demo"
DirectoryName = "fulma-demo"
Tag = "master"
SourceSubDirectory = "src"
BuildConfigurationFn = configureBuildCommandFromFakeBuildScripts "fake" "build" }
]

let externalProjectsToTestFailing = [
Expand Down Expand Up @@ -151,6 +146,11 @@ let externalProjectsToTestFailing = [
Tag = "v1.0.0"
SourceSubDirectory = "src"
BuildConfigurationFn = configureBuildCommandFromDefaultFakeBuildScripts }
{ GitUrl = @"https://github.com/MangelMaxime/fulma-demo"
DirectoryName = "fulma-demo"
Tag = "master"
SourceSubDirectory = "src"
BuildConfigurationFn = configureBuildCommandFromFakeBuildScripts "fake" "build" }
]

// --------------------------------------------------------------------------------------
Expand Down
34 changes: 34 additions & 0 deletions src/Fantomas.Tests/RecordTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,38 @@ type MyExc =
type MyExc =
inherit Exception
new(msg) = { inherit Exception(msg) }
"""

[<Test>]
let ``should preserve inherit parts in records with field``() =
formatSourceString false """
type MyExc =
inherit Exception
new(msg) = {inherit Exception(msg)
X = 1}
""" config
|> prepend newline
|> should equal """
type MyExc =
inherit Exception
new(msg) = { inherit Exception(msg); X = 1 }
"""

[<Test>]
let ``should preserve inherit parts in records multiline``() =
formatSourceString false """
type MyExc =
inherit Exception
new(msg) = {inherit Exception(msg)
X = 1
Y = 2}
""" config
|> prepend newline
|> should equal """
type MyExc =
inherit Exception
new(msg) =
{ inherit Exception(msg)
X = 1
Y = 2 }
"""
7 changes: 4 additions & 3 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,11 @@ and genExpr astContext synExpr =
(sepOpenL +> atCurrentColumn (colAutoNlnSkip0 sepWithPreserveEndOfLine xs (genExpr astContext)) +> sepCloseL)

| Record(inheritOpt, xs, eo) ->
let recordExpr = opt (!- " with ") eo (genExpr astContext) +> atCurrentColumn (col sepSemiNln xs (genRecordFieldName astContext))
sepOpenS
+> opt (if xs.IsEmpty then sepNone else sepSemi) inheritOpt
(fun (typ, expr) -> !- "inherit " +> genType astContext false typ +> genExpr astContext expr)
+> opt (!- " with ") eo (genExpr astContext) +> atCurrentColumn (col sepSemiNln xs (genRecordFieldName astContext))
+> atCurrentColumn (opt (if xs.IsEmpty then sepNone else ifElseCtx (futureNlnCheck recordExpr sepNone) sepNln sepSemi) inheritOpt
(fun (typ, expr) -> !- "inherit " +> genType astContext false typ +> genExpr astContext expr))
+> recordExpr
+> sepCloseS

| ObjExpr(t, eio, bd, ims, range) ->
Expand Down

0 comments on commit 2090601

Please sign in to comment.