Skip to content

Commit

Permalink
refine exception shape
Browse files Browse the repository at this point in the history
  • Loading branch information
Eirik Tsarpalis committed Sep 16, 2017
1 parent 0ac2ae1 commit 6d3ea1e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 2.19
* Refine exception shapes

### 2.18
* Add Subtype shapes.

Expand Down
8 changes: 4 additions & 4 deletions src/TypeShape.CSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
[assembly: AssemblyTitleAttribute("TypeShape.CSharp")]
[assembly: AssemblyProductAttribute("TypeShape")]
[assembly: AssemblyDescriptionAttribute("Practical Generic Programming in F#")]
[assembly: AssemblyVersionAttribute("2.18")]
[assembly: AssemblyFileVersionAttribute("2.18")]
[assembly: AssemblyVersionAttribute("2.19")]
[assembly: AssemblyFileVersionAttribute("2.19")]
namespace System {
internal static class AssemblyVersionInformation {
internal const System.String AssemblyTitle = "TypeShape.CSharp";
internal const System.String AssemblyProduct = "TypeShape";
internal const System.String AssemblyDescription = "Practical Generic Programming in F#";
internal const System.String AssemblyVersion = "2.18";
internal const System.String AssemblyFileVersion = "2.18";
internal const System.String AssemblyVersion = "2.19";
internal const System.String AssemblyFileVersion = "2.19";
}
}
8 changes: 4 additions & 4 deletions src/TypeShape/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("TypeShape")>]
[<assembly: AssemblyProductAttribute("TypeShape")>]
[<assembly: AssemblyDescriptionAttribute("Practical Generic Programming in F#")>]
[<assembly: AssemblyVersionAttribute("2.18")>]
[<assembly: AssemblyFileVersionAttribute("2.18")>]
[<assembly: AssemblyVersionAttribute("2.19")>]
[<assembly: AssemblyFileVersionAttribute("2.19")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "TypeShape"
let [<Literal>] AssemblyProduct = "TypeShape"
let [<Literal>] AssemblyDescription = "Practical Generic Programming in F#"
let [<Literal>] AssemblyVersion = "2.18"
let [<Literal>] AssemblyFileVersion = "2.18"
let [<Literal>] AssemblyVersion = "2.19"
let [<Literal>] AssemblyFileVersion = "2.19"
4 changes: 2 additions & 2 deletions src/TypeShape/TypeShape.fs
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,13 @@ type private ShapeFSharpFunc<'Domain, 'CoDomain> () =
// System.Exception

type IExceptionVisitor<'R> =
abstract Visit<'exn when 'exn :> exn> : unit -> 'R
abstract Visit<'exn when 'exn :> exn and 'exn : not struct and 'exn : null> : unit -> 'R

type IShapeException =
abstract IsFSharpException : bool
abstract Accept : IExceptionVisitor<'R> -> 'R

type private ShapeException<'exn when 'exn :> exn> (isFSharpExn : bool) =
type private ShapeException<'exn when 'exn :> exn and 'exn : not struct and 'exn : null> (isFSharpExn : bool) =
interface IShapeException with
member __.IsFSharpException = isFSharpExn
member __.Accept v = v.Visit<'exn> ()
Expand Down
2 changes: 1 addition & 1 deletion tests/TypeShape.Tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ let ``Shape FSharpFunc`` () =
let ``Shape Exception`` () =
let accepter =
{ new IExceptionVisitor<bool> with
member __.Visit<'exn when 'exn :> exn>() = typeof<'exn> = typeof<System.IO.FileNotFoundException> }
member __.Visit<'exn when 'exn :> exn and 'exn : not struct and 'exn : null>() = typeof<'exn> = typeof<System.IO.FileNotFoundException> }
test <@ match shapeof<System.IO.FileNotFoundException> with Shape.Exception s -> s.Accept accepter | _ -> false @>

[<Fact>]
Expand Down

0 comments on commit 6d3ea1e

Please sign in to comment.