You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Various parenthesization API fixes. ([PR #16977](https://github.com/dotnet/fsharp/pull/16977))
5
-
* Fix bug in optimization of for-loops over integral ranges with steps and units of measure. ([Issue #17025](https://github.com/dotnet/fsharp/issues/17025), [PR #17040](https://github.com/dotnet/fsharp/pull/17040))
4
+
* Various parenthesization API fixes. ([PR #16977](https://github.com/dotnet/fsharp/pull/16977))
5
+
* Fix bug in optimization of for-loops over integral ranges with steps and units of measure. ([Issue #17025](https://github.com/dotnet/fsharp/issues/17025), [PR #17040](https://github.com/dotnet/fsharp/pull/17040), [PR #17048](https://github.com/dotnet/fsharp/pull/17048))
6
6
* Fix calling an overridden virtual static method via the interface ([PR #17013](https://github.com/dotnet/fsharp/pull/17013))
Copy file name to clipboardExpand all lines: src/Compiler/TypedTree/TypedTreeOps.fs
+19-27Lines changed: 19 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -10434,41 +10434,37 @@ let mkRangeCount g m rangeTy rangeExpr start step finish =
10434
10434
mkAsmExpr ([AI_clt_un], [], [e1; e2], [g.bool_ty], m)
10435
10435
10436
10436
let unsignedEquivalent ty =
10437
-
if typeEquiv g ty g.int64_ty then g.uint64_ty
10438
-
elif typeEquiv g ty g.int32_ty then g.uint32_ty
10439
-
elif typeEquiv g ty g.int16_ty then g.uint16_ty
10440
-
elif typeEquiv g ty g.sbyte_ty then g.byte_ty
10437
+
if typeEquivAux EraseMeasures g ty g.int64_ty then g.uint64_ty
10438
+
elif typeEquivAux EraseMeasures g ty g.int32_ty then g.uint32_ty
10439
+
elif typeEquivAux EraseMeasures g ty g.int16_ty then g.uint16_ty
10440
+
elif typeEquivAux EraseMeasures g ty g.sbyte_ty then g.byte_ty
10441
10441
else ty
10442
10442
10443
10443
/// Find the unsigned type with twice the width of the given type, if available.
10444
10444
let nextWidestUnsignedTy ty =
10445
-
let ty = stripMeasuresFromTy g ty
10446
-
10447
-
if typeEquiv g ty g.int64_ty || typeEquiv g ty g.int32_ty || typeEquiv g ty g.uint32_ty then
10445
+
if typeEquivAux EraseMeasures g ty g.int64_ty || typeEquivAux EraseMeasures g ty g.int32_ty || typeEquivAux EraseMeasures g ty g.uint32_ty then
10448
10446
g.uint64_ty
10449
-
elif typeEquiv g ty g.int16_ty || typeEquiv g ty g.uint16_ty || typeEquiv g ty g.char_ty then
10447
+
elif typeEquivAux EraseMeasures g ty g.int16_ty || typeEquivAux EraseMeasures g ty g.uint16_ty || typeEquivAux EraseMeasures g ty g.char_ty then
10450
10448
g.uint32_ty
10451
-
elif typeEquiv g ty g.sbyte_ty || typeEquiv g ty g.byte_ty then
10449
+
elif typeEquivAux EraseMeasures g ty g.sbyte_ty || typeEquivAux EraseMeasures g ty g.byte_ty then
10452
10450
g.uint16_ty
10453
10451
else
10454
10452
ty
10455
10453
10456
10454
/// Convert the value to the next-widest unsigned type.
10457
10455
/// We do this so that adding one won't result in overflow.
10458
10456
let mkWiden e =
10459
-
let ty = stripMeasuresFromTy g rangeTy
10460
-
10461
-
if typeEquiv g ty g.int32_ty then
10457
+
if typeEquivAux EraseMeasures g rangeTy g.int32_ty then
10462
10458
mkAsmExpr ([AI_conv DT_I8], [], [e], [g.uint64_ty], m)
10463
-
elif typeEquiv g ty g.uint32_ty then
10459
+
elif typeEquivAux EraseMeasures g rangeTy g.uint32_ty then
10464
10460
mkAsmExpr ([AI_conv DT_U8], [], [e], [g.uint64_ty], m)
10465
-
elif typeEquiv g ty g.int16_ty then
10461
+
elif typeEquivAux EraseMeasures g rangeTy g.int16_ty then
10466
10462
mkAsmExpr ([AI_conv DT_I4], [], [e], [g.uint32_ty], m)
10467
-
elif typeEquiv g ty g.uint16_ty || typeEquiv g ty g.char_ty then
10463
+
elif typeEquivAux EraseMeasures g rangeTy g.uint16_ty || typeEquivAux EraseMeasures g rangeTy g.char_ty then
10468
10464
mkAsmExpr ([AI_conv DT_U4], [], [e], [g.uint32_ty], m)
10469
-
elif typeEquiv g ty g.sbyte_ty then
10465
+
elif typeEquivAux EraseMeasures g rangeTy g.sbyte_ty then
10470
10466
mkAsmExpr ([AI_conv DT_I2], [], [e], [g.uint16_ty], m)
10471
-
elif typeEquiv g ty g.byte_ty then
10467
+
elif typeEquivAux EraseMeasures g rangeTy g.byte_ty then
10472
10468
mkAsmExpr ([AI_conv DT_U2], [], [e], [g.uint16_ty], m)
10473
10469
else
10474
10470
e
@@ -10481,12 +10477,10 @@ let mkRangeCount g m rangeTy rangeExpr start step finish =
10481
10477
10482
10478
/// Whether the total count might not fit in 64 bits.
10483
10479
let couldBeTooBig ty =
10484
-
let underlying = stripMeasuresFromTy g ty
10485
-
10486
-
typeEquiv g underlying g.int64_ty
10487
-
|| typeEquiv g underlying g.uint64_ty
10488
-
|| typeEquiv g underlying g.nativeint_ty
10489
-
|| typeEquiv g underlying g.unativeint_ty
10480
+
typeEquivAux EraseMeasures g ty g.int64_ty
10481
+
|| typeEquivAux EraseMeasures g ty g.uint64_ty
10482
+
|| typeEquivAux EraseMeasures g ty g.nativeint_ty
10483
+
|| typeEquivAux EraseMeasures g ty g.unativeint_ty
10490
10484
10491
10485
/// pseudoCount + 1
10492
10486
let mkAddOne pseudoCount =
@@ -10499,16 +10493,14 @@ let mkRangeCount g m rangeTy rangeExpr start step finish =
10499
10493
mkAsmExpr ([AI_add], [], [pseudoCount; mkTypedOne g m ty], [ty], m)
10500
10494
10501
10495
let mkRuntimeCalc mkThrowIfStepIsZero pseudoCount count =
10502
-
let underlying = stripMeasuresFromTy g rangeTy
10503
-
10504
-
if typeEquiv g underlying g.int64_ty || typeEquiv g underlying g.uint64_ty then
10496
+
if typeEquivAux EraseMeasures g rangeTy g.int64_ty || typeEquivAux EraseMeasures g rangeTy g.uint64_ty then
10505
10497
RangeCount.PossiblyOversize (fun mkLoopExpr ->
10506
10498
mkThrowIfStepIsZero
10507
10499
(mkCompGenLetIn m (nameof pseudoCount) (tyOfExpr g pseudoCount) pseudoCount (fun (_, pseudoCount) ->
10508
10500
let wouldOvf = mkILAsmCeq g m pseudoCount (Expr.Const (Const.UInt64 UInt64.MaxValue, m, g.uint64_ty))
10509
10501
mkCompGenLetIn m (nameof wouldOvf) g.bool_ty wouldOvf (fun (_, wouldOvf) ->
10510
10502
mkLoopExpr count wouldOvf))))
10511
-
elif typeEquiv g underlying g.nativeint_ty || typeEquiv g underlying g.unativeint_ty then // We have a nativeint ty whose size we won't know till runtime.
10503
+
elif typeEquivAux EraseMeasures g rangeTy g.nativeint_ty || typeEquivAux EraseMeasures g rangeTy g.unativeint_ty then // We have a nativeint ty whose size we won't know till runtime.
10512
10504
RangeCount.PossiblyOversize (fun mkLoopExpr ->
10513
10505
mkThrowIfStepIsZero
10514
10506
(mkCompGenLetIn m (nameof pseudoCount) (tyOfExpr g pseudoCount) pseudoCount (fun (_, pseudoCount) ->
0 commit comments