Skip to content

Commit

Permalink
add tests to verify correct usage of new argument on AllowNullLiteral…
Browse files Browse the repository at this point in the history
…Attribute
  • Loading branch information
mexx committed Apr 29, 2015
1 parent 37aa969 commit 574b9b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/fsharp/typecheck/sigs/neg16.bsl
Expand Up @@ -88,3 +88,5 @@ neg16.fs(110,16,110,20): typecheck error FS0879: Volatile fields must be marked
neg16.fs(113,9,113,11): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static

neg16.fs(116,9,116,13): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static

neg16.fs(130,10,130,11): typecheck error FS0935: Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal
8 changes: 8 additions & 0 deletions tests/fsharp/typecheck/sigs/neg16.fs
Expand Up @@ -122,3 +122,11 @@ module VolatileFieldSanityChecks = begin

end

module AllowNullLiteralWithArgumentTest = begin

type A() = class end

[<AllowNullLiteral(true)>] // expect an error here
type B() = inherit A()

end
7 changes: 7 additions & 0 deletions tests/fsharp/typecheck/sigs/pos16.fs
Expand Up @@ -46,3 +46,10 @@ module UnitOfMeasurePrintfPositiveTests =
let _ = sprintf "%g" 1.0M<metre>
let _ = sprintf "%g" 1.0M<m>
let _ = sprintf "%g" 1.0M<m/s>

module AllowNullLiteralWithArgumentTest =

type A() = class end

[<AllowNullLiteral(false)>]
type B() = inherit A()

0 comments on commit 574b9b3

Please sign in to comment.