Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b249d8

Browse files
mexxlatkin
authored andcommitted
handle AllowNullLiteral(false) correctly,fixesdotnet#383
closesdotnet#390commita9c9d60Author: Max Malook <community@malook.de>Date: Wed Apr 29 04:43:26 2015 +0200 handle AllowNullLiteral(false) correctly,fixesdotnet#383commit574b9b3Author: Max Malook <community@malook.de>Date: Wed Apr 29 01:34:54 2015 +0200 add tests to verify correct usage of new argument on AllowNullLiteralAttribute
1 parent37aa969 commit8b249d8

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

‎src/fsharp/tc.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13982,7 +13982,7 @@ module EstablishTypeDefinitionCores = begin
1398213982
let hasCLIMutable = HasFSharpAttribute cenv.g cenv.g.attrib_CLIMutableAttribute attrs
1398313983

1398413984
let hasStructLayoutAttr = HasFSharpAttribute cenv.g cenv.g.attrib_StructLayoutAttribute attrs
13985-
let hasAllowNullLiteralAttr =HasFSharpAttribute cenv.g cenv.g.attrib_AllowNullLiteralAttribute attrs
13985+
let hasAllowNullLiteralAttr =TryFindFSharpBoolAttribute cenv.g cenv.g.attrib_AllowNullLiteralAttribute attrs = Some(true)
1398613986

1398713987
if hasAbstractAttr then
1398813988
tycon.TypeContents.tcaug_abstract <- true

‎tests/fsharp/typecheck/sigs/neg16.bsl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,5 @@ neg16.fs(110,16,110,20): typecheck error FS0879: Volatile fields must be marked
8888
neg16.fs(113,9,113,11): typecheck error FS0879: Volatile fields must be marked 'mutable'and cannot be thread-static
8989

9090
neg16.fs(116,9,116,13): typecheck error FS0879: Volatile fields must be marked 'mutable'and cannot be thread-static
91+
92+
neg16.fs(130,10,130,11): typecheck error FS0935: Types with the 'AllowNullLiteral' attribute may only inherit fromor implement types which also allow the use of thenull literal

‎tests/fsharp/typecheck/sigs/neg16.fs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,11 @@ module VolatileFieldSanityChecks = begin
122122

123123
end
124124

125+
moduleAllowNullLiteralWithArgumentTest=begin
126+
127+
typeA()=classend
128+
129+
[<AllowNullLiteral(true)>]// expect an error here
130+
typeB()=inherit A()
131+
132+
end

‎tests/fsharp/typecheck/sigs/pos16.fs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@ module UnitOfMeasurePrintfPositiveTests =
4646
let_= sprintf"%g"1.0M<metre>
4747
let_= sprintf"%g"1.0M<m>
4848
let_= sprintf"%g"1.0M<m/s>
49+
50+
moduleAllowNullLiteralWithArgumentTest=
51+
52+
typeA()=classend
53+
54+
[<AllowNullLiteral(false)>]
55+
typeB()=inherit A()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp