This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2010-06-11 Rolf Bjarne Kvinge <RKvinge@novell.com> * General/TypeResolution.vb: IsImplicitlyConvertible: two nullable types can convert between eachother if the nulled types are implicitly convertible. * General/TypeCache.vb: * General/TypeCache.Generated.vb: Regenerated. * General/TypeCache.in: Added Nullable.HasValue and Nullable.GetValueOrDefault. * General/Helper.vb: Add helper method to pretty-print types. * General/CecilHelper.vb: Add helper methods to check if a type is nullable and get the nulled type. * Expressions/Conversions/CTypeExpression.vb: Implement implicit conversion between nullable types. In vbnc/vbnc/tests: 2010-06-11 Rolf Bjarne Kvinge <RKvinge@novell.com> * tests.xml: * Errors/30512-4.vb: * Errors/30311-37.vb: * Errors/30311-36.vb: * CompileTime2/ImplicitNullableConversions1.vb: * CompileTime2/UserDefinedNullableConversions1.vb: Added new tests. svn path=/trunk/mono-basic/; revision=158827
- Loading branch information
1 parent
2e3fde0
commit efa3380
Showing
15 changed files
with
319 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
vbnc/vbnc/tests/CompileTime2/ImplicitNullableConversions1.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
Option Strict On | ||
Class ImplicitNullableConversions1 | ||
Shared Function Main() As Integer | ||
Dim b As Nullable(Of Byte) | ||
Dim sb As Nullable(Of SByte) | ||
Dim i16 As Nullable(Of Short) | ||
Dim u16 As Nullable(Of UShort) | ||
Dim i32 As Nullable(Of Integer) | ||
Dim u32 As Nullable(Of UInteger) | ||
Dim i64 As Nullable(Of Long) | ||
Dim u64 As Nullable(Of ULong) | ||
Dim s As Nullable(Of Single) | ||
Dim f As Nullable(Of Double) | ||
Dim d As Nullable(Of Decimal) | ||
Dim dt As Nullable(Of Date) | ||
Dim c As Nullable(Of Char) | ||
Dim boo As Nullable(Of Boolean) | ||
|
||
d = u64 | ||
d = u32 | ||
d = u16 | ||
d = b | ||
d = i64 | ||
d = i32 | ||
d = i16 | ||
d = sb | ||
|
||
f = d | ||
f = s | ||
f = u64 | ||
f = u32 | ||
f = u16 | ||
f = b | ||
f = i64 | ||
f = i32 | ||
f = i16 | ||
f = sb | ||
|
||
s = u64 | ||
s = u32 | ||
s = u16 | ||
s = b | ||
s = i64 | ||
s = i32 | ||
s = i16 | ||
s = sb | ||
|
||
u64 = u32 | ||
u64 = u16 | ||
u64 = b | ||
|
||
u32 = u16 | ||
u32 = b | ||
|
||
u16 = b | ||
|
||
i64 = i32 | ||
i64 = i16 | ||
i64 = sb | ||
i64 = u32 | ||
i64 = u16 | ||
i64 = b | ||
|
||
i32 = i16 | ||
i32 = sb | ||
i32 = u16 | ||
i32 = b | ||
|
||
i16 = sb | ||
i16 = b | ||
|
||
End Function | ||
End Class |
25 changes: 25 additions & 0 deletions
25
vbnc/vbnc/tests/CompileTime2/UserDefinedNullableConversions1.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Option Strict On | ||
Class UserDefinedNullableConversions1 | ||
Shared Function Main() As Integer | ||
Dim d As Nullable(Of Decimal) | ||
Dim c As Nullable(Of Char) | ||
Dim from As Nullable(Of From) | ||
Dim [to] As Nullable(Of [To]) | ||
|
||
' vbc compiles char? -> decimal? using a user defined char->decimal widening operator on decimal | ||
d = c | ||
[to] = [from] | ||
End Function | ||
|
||
Structure From | ||
Dim i As Integer | ||
Public Shared Widening Operator CType(ByVal a As From) As [To] | ||
Return New [To] | ||
End Operator | ||
End Structure | ||
|
||
Structure [To] | ||
Dim i As Integer | ||
End Structure | ||
|
||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Class ImplicitNullableConversions1 | ||
Shared Function Main() As Integer | ||
Dim c As Nullable(Of Char) | ||
Dim boo As Nullable(Of Boolean) | ||
|
||
boo = c | ||
End Function | ||
|
||
|
||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Option Strict On | ||
Class ImplicitNullableConversions1 | ||
Shared Function Main() As Integer | ||
Dim f As Nullable(Of Double) | ||
Dim c As Nullable(Of Char) | ||
f = c | ||
End Function | ||
|
||
End Class |
Oops, something went wrong.