Skip to content

Commit

Permalink
Allow solution to build
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Sep 13, 2024
1 parent 9ccf437 commit ec0ad23
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Fantomas.Core.Tests/Fantomas.Core.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
<Compile Include="DotLambdaTests.fs" />
<Compile Include="ConstraintIntersectionTests.fs" />
<Compile Include="BeginEndTests.fs" />
<Compile Include="NullnessTests.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fantomas.Core\Fantomas.Core.fsproj" />
Expand Down
21 changes: 21 additions & 0 deletions src/Fantomas.Core.Tests/NullnessTests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module Fantomas.Core.Tests.NullnessTests

open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelpers

[<Test>]
let ``abstract property`` () =
formatSourceString
"""
[<AbstractClass>]
type AbstractBase() =
abstract Property1 : string | null with get, set
"""
config
|> prepend newline
|> should
equal
"""
"""
10 changes: 8 additions & 2 deletions src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ let mkSynAccess (vis: SynAccess option) =
| Some(SynAccess.Private range) -> Some(stn "private" range)
| Some(SynAccess.Public range) -> Some(stn "public" range)

let mkSynValSigAccess (vis: SynValSigAccess) =
// https://fsharp.github.io/fsharp-compiler-docs/reference/fsharp-compiler-syntax-synvalsigaccess.html
failwith "todo SynValSigAccess: %A" vis

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

Check warning on line 83 in src/Fantomas.Core/ASTTransformer.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

Redundant arguments are being ignored in function 'failwith'. Expected 1 but got 2 arguments.

let parseExpressionInSynBinding returnInfo expr =
match returnInfo, expr with
| Some(SynBindingReturnInfo(typeName = t1)), SynExpr.Typed(e, t2, _) when RangeHelpers.rangeEq t1.Range t2.Range ->
Expand Down Expand Up @@ -2168,6 +2172,8 @@ let mkSynTypeConstraint (creationAide: CreationAide) (tc: SynTypeConstraint) : T
TypeConstraintEnumOrDelegateNode(mkSynTypar tp, "delegate", List.map (mkType creationAide) ts, m)
|> TypeConstraint.EnumOrDelegate
| SynTypeConstraint.WhereSelfConstrained(t, _) -> mkType creationAide t |> TypeConstraint.WhereSelfConstrained
| SynTypeConstraint.WhereTyparNotSupportsNull(genericName, range) ->
failwithf "todo WhereTyparNotSupportsNull : %A" (genericName, range)

// Arrow type is right-associative
let rec (|TFuns|_|) =
Expand Down Expand Up @@ -2845,7 +2851,7 @@ let mkMemberDefn (creationAide: CreationAide) (md: SynMemberDefn) =
mkXmlDoc px,
mkAttributes creationAide ats,
mkSynLeadingKeyword lk,
mkSynAccess ao,
mkSynValSigAccess ao,
mkIdent ident,
Option.map (mkType creationAide) typeOpt,
stn "=" mEq,
Expand Down Expand Up @@ -3027,7 +3033,7 @@ let mkVal
lk,
Option.map (stn "inline") trivia.InlineKeyword,
isMutable,
mkSynAccess ao,
mkSynValSigAccess ao,
mkSynIdent synIdent,
mkSynValTyparDecls creationAide (Some vtd),
mkType creationAide t,
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas/EditorConfig.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Reflection =
DisplayName: string option
Description: string option }

let inline getCustomAttribute<'t, 'v when 't :> Attribute and 't: null>
let inline getCustomAttribute<'t, 'v when 't :> Attribute and 't: null and 't: not struct>
(projection: 't -> 'v)
(property: PropertyInfo)
: 'v option =
Expand Down

0 comments on commit ec0ad23

Please sign in to comment.