@@ -609,6 +609,8 @@ module Annotation =
609609 | Fable.String -> StringTypeAnnotation
610610 | Fable.Regex -> makeAliasTypeAnnotation com ctx " RegExp"
611611 | Fable.Number( BigInt, _) -> makeAliasTypeAnnotation com ctx " bigint"
612+ | Fable.Number( Int32, Fable.NumberInfo.IsEnum ent) when ent.FullName = " System.DateTimeKind" ->
613+ makeFableLibImportTypeAnnotation com ctx [] " Util" " DateTimeKind"
612614 | Fable.Number( kind, _) -> makeNumericTypeAnnotation com ctx kind
613615 | Fable.Nullable( genArg, isStruct) -> makeNullableTypeAnnotation com ctx isStruct genArg
614616 | Fable.Option( genArg, isStruct) -> makeOptionTypeAnnotation com ctx isStruct genArg
@@ -1462,7 +1464,7 @@ module Util =
14621464 match e, typ with
14631465 | Literal( NumericLiteral(_)), _ -> e
14641466 // TODO: Unsigned ints seem to cause problems, should we check only Int32 here?
1465- | _, Fable.Number(( Int8 | Int16 | Int32), _ ) ->
1467+ | _, Fable.Number(( Int8 | Int16 | Int32), Fable.NumberInfo.Empty ) ->
14661468 Expression.binaryExpression ( BinaryOrBitwise, e, Expression.numericLiteral ( 0. ))
14671469 | _ -> e
14681470
@@ -3402,10 +3404,10 @@ but thanks to the optimisation done below we get
34023404 |> Seq.choose ( fun ifc ->
34033405 match ifc.Entity.FullName with
34043406 // Discard non-generic versions of IEquatable & IComparable
3405- | " System.IEquatable "
3407+ | Types.iequatable
34063408 | Types.iStructuralEquatable
34073409 | Types.iequalityComparer
3408- | " System.IComparable "
3410+ | Types.icomparable
34093411 | Types.iStructuralComparable
34103412 | Types.ienumerable
34113413 | Types.ienumerator -> None
@@ -3812,10 +3814,37 @@ but thanks to the optimisation done below we get
38123814 Parameter.parameter ( " fields" , typeAnnotation = fieldsArgTa)
38133815 |]
38143816
3815- let consArgsModifiers = [| Readonly ; Readonly |]
3817+ let consArgsModifiers = [||]
38163818
3817- let consBody = BlockStatement [| callSuperAsStatement [] |]
3818- let classMembers = Array.append [| cases |] classMembers
3819+ let consBody =
3820+ BlockStatement
3821+ [|
3822+ callSuperAsStatement []
3823+ yield !
3824+ [ " tag" ; " fields" ]
3825+ |> List.map ( fun name ->
3826+ let left = get None thisExpr name
3827+ let right = Expression.identifier ( name)
3828+ assign None left right |> ExpressionStatement
3829+ )
3830+ |]
3831+
3832+ let classMembers =
3833+ [|
3834+ ClassMember.classProperty (
3835+ Expression.identifier " tag" ,
3836+ typeAnnotation = tagArgTa,
3837+ accessModifier = Readonly
3838+ )
3839+
3840+ ClassMember.classProperty (
3841+ Expression.identifier " fields" ,
3842+ typeAnnotation = fieldsArgTa,
3843+ accessModifier = Readonly
3844+ )
3845+ cases
3846+ yield ! classMembers
3847+ |]
38193848
38203849 let unionConsTypeParams =
38213850 Some(
0 commit comments