1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
// #Regression #Conformance #Accessibility #SignatureFiles #Regression #Records #Unions
#if ALL_IN_ONE
module Core_access
#endif
#light
let failures = ref []
let report_failure (s : string) =
stderr.Write" NO: "
stderr.WriteLine s
failures := !failures @ [s]
let test (s : string) b =
stderr.Write(s)
if b then stderr.WriteLine " OK"
else report_failure (s)
(*--------------------*)
// Test cases for bug://1562
// Checking that generated signature can be compiled against the file.
type internal typInternal = | AAA1
type private typPrivate = | AAA2
type public typPublic = | AAA3
type typDefault = | AAA4
type internal rrr = | AAA
let internal ValInternal = 1212
let private ValPrivate = 1212
let public ValPublic = 1212
let ValDefault = 1212
type MyClassFields =
val internal fieldInternal : int
val private fieldPrivate : int
val public fieldPublic : int
type MyClassMutableFields =
val mutable internal mfieldInternal : int
val mutable private mfieldPrivate : int
val mutable public mfieldPublic : int
type MyClassStaticMembers =
static member internal SInternal = 12
static member private SPrivate = 12
static member public SPublic = 12
static member SDefault = 12
static member internal SMInternal() = 12
static member private SMPrivate() = 12
static member public SMPublic() = 12
static member SMDefault() = 12
type MyClassPropertiyGetters =
member internal x.InstInternal = 12
member private x.InstPrivate = 12
member public x.InstPublic = 12
member x.InstDefault = 12
type MyClassExplicitCtors =
val v : int
internal new(x) = { v = x }
private new(x,y) = { v = x + y}
public new(x,y,z) = { v = x + y + z}
type MyClassExplicitCtors2 =
new() = {}
internal new(x) = let v : int = x in {}
private new(x,y) = let v : int = x + y in {}
public new(x,y,z) = let v : int = x + y + z in {}
type MyClassPropertyGetSetterMatrix =
//--
member obj.PropGetSetInternalInternal
with internal get() = 1
and internal set(x:int) = ()
member obj.PropGetSetInternalPrivate
with internal get() = 1
and private set(x:int) = ()
member obj.PropGetSetInternalPublic
with internal get() = 1
and public set(x:int) = ()
//--
member obj.PropGetSetPrivateInternal
with private get() = 1
and internal set(x:int) = ()
member obj.PropGetSetPrivatePrivate
with private get() = 1
and private set(x:int) = ()
member obj.PropGetSetPrivatePublic
with private get() = 1
and public set(x:int) = ()
//--
member obj.PropGetSetPublicInternal
with public get() = 1
and internal set(x:int) = ()
member obj.PropGetSetPublicPrivate
with public get() = 1
and private set(x:int) = ()
member obj.PropGetSetPublicPublic
with public get() = 1
and public set(x:int) = ()
type MyClassImplicitCtorInternal internal() =
member obj.Res = 12
type MyClassImplicitCtorPrivate private() =
member obj.Res = 12
module internal ModInternal = begin end
module private ModPrivate = begin end
module public ModPublic = begin end
type recordRepInternal = internal { rfA1 : int }
type recordRepPrivate = private { rfA2 : int }
type recordRepPublic = public { rfA3 : int }
type dtypeRepInternal = internal | AA1 | BB1
type dtypeRepPrivate = private | AA2 | BB2
type dtypeRepPublic = public | AA3 | BB3
type internal dtypeRepPublic2 = private | AA3 | BB3
type private dtypeRepPublic3 = internal | AA3 | BB3
type internal dtypeRepPublic4 =
private
| AA3
| BB3
module internal M =
module private PP =
type dtypeRepPublic5 =
| AA3
| BB3
module private M2 =
module internal P =
let vv = 12
module RestrictedRecordsAndUnionsUsingPrivateAndInternalTypes =
module public Test1 =
type internal Data =
{
Datum: int
}
type public Datum =
internal
{
Thing: Data
}
type public Datum2 =
internal | A of Data * Data | B of Data
module public Test2 =
type internal Data =
{
Datum: int
}
type internal Datum =
{
Thing: Data
}
type internal Datum2 =
| A of Data * Data | B of Data
module public Test3 =
type public Data =
internal
{
Datum: int
}
type internal Datum =
{
Thing: Data
}
type internal Datum2 =
internal | A of Data * Data | B of Data
module public Test4 =
type internal Data =
{
Datum: int
}
type public Datum =
internal
{
Thing: Data
}
type public Datum2 =
internal | A of Data * Data | B of Data
module public Test5 =
type private Data =
{
Datum: int
}
type public Datum =
private
{
Thing: Data
}
type public Datum2 =
private | A of Data * Data | B of Data
module Test6 =
module internal HelperModule =
type public Data =
private
{
Datum: int
}
let internal handle (data:Data): int = data.Datum
module public Module =
type public Data =
private
{
Thing: HelperModule.Data
}
let public getInt (data:Data): int = HelperModule.handle data.Thing
module Test7 =
module internal HelperModule =
type Data =
{
Datum: int
}
let handle (data:Data): int = data.Datum
module Module =
type Data =
internal
{
Thing: HelperModule.Data
}
let getInt (data:Data): int = HelperModule.handle data.Thing
(*--------------------*)
#if ALL_IN_ONE
let RUN() = !failures
#else
let aa =
match !failures with
| [] ->
stdout.WriteLine "Test Passed"
System.IO.File.WriteAllText("test.ok","ok")
exit 0
| _ ->
stdout.WriteLine "Test Failed"
exit 1
#endif
|