|
4 | 4 |
|
5 | 5 | ## CHANGELOG
|
6 | 6 |
|
| 7 | +2023.10.27 |
| 8 | + - **CHANGE** Update **UP** to handle intersection types earlier. This |
| 9 | + prevents **UP** from producing results of the form `(X & B)?`. |
| 10 | + |
7 | 11 | 2020.09.01
|
8 | 12 | - **CHANGE** Update **UP** in cases about type variables and promoted type
|
9 | 13 | variables involving F-bounds, and in two cases about function types.
|
@@ -81,6 +85,20 @@ We define the upper bound of two types T1 and T2 to be **UP**(`T1`,`T2`) as foll
|
81 | 85 | - **UP**(`T1`, `T2`) = `T2` if **BOTTOM**(`T1`)
|
82 | 86 | - **UP**(`T1`, `T2`) = `T1` if **BOTTOM**(`T2`)
|
83 | 87 |
|
| 88 | +- **UP**(`X1 & B1`, `T2`) = |
| 89 | + - `T2` if `X1 <: T2` |
| 90 | + - otherwise `X1` if `T2 <: X1` |
| 91 | + - otherwise **UP**(`B1a`, `T2`) |
| 92 | + where `B1a` is the greatest closure of `B1` with respect to `X1`, |
| 93 | + as defined in [inference.md]. |
| 94 | + |
| 95 | +- **UP**(`T1`, `X2 & B2`) = |
| 96 | + - `X2` if `T1 <: X2` |
| 97 | + - otherwise `T1` if `X2 <: T1` |
| 98 | + - otherwise **UP**(`T1`, `B2a`) |
| 99 | + where `B2a` is the greatest closure of `B2` with respect to `X2`, |
| 100 | + as defined in [inference.md]. |
| 101 | + |
84 | 102 | - **UP**(`T1`, `T2`) where **NULL**(`T1`) and **NULL**(`T2`) =
|
85 | 103 | - `T2` if **MOREBOTTOM**(`T1`, `T2`)
|
86 | 104 | - `T1` otherwise
|
@@ -126,27 +144,13 @@ We define the upper bound of two types T1 and T2 to be **UP**(`T1`,`T2`) as foll
|
126 | 144 | where `B1a` is the greatest closure of `B1` with respect to `X1`,
|
127 | 145 | as defined in [inference.md].
|
128 | 146 |
|
129 |
| -- **UP**(`X1 & B1`, `T2`) = |
130 |
| - - `T2` if `X1 <: T2` |
131 |
| - - otherwise `X1` if `T2 <: X1` |
132 |
| - - otherwise **UP**(`B1a`, `T2`) |
133 |
| - where `B1a` is the greatest closure of `B1` with respect to `X1`, |
134 |
| - as defined in [inference.md]. |
135 |
| - |
136 | 147 | - **UP**(`T1`, `X2 extends B2`) =
|
137 | 148 | - `X2` if `T1 <: X2`
|
138 | 149 | - otherwise `T1` if `X2 <: T1`
|
139 | 150 | - otherwise **UP**(`T1`, `B2a`)
|
140 | 151 | where `B2a` is the greatest closure of `B2` with respect to `X2`,
|
141 | 152 | as defined in [inference.md].
|
142 | 153 |
|
143 |
| -- **UP**(`T1`, `X2 & B2`) = |
144 |
| - - `X2` if `T1 <: X2` |
145 |
| - - otherwise `T1` if `X2 <: T1` |
146 |
| - - otherwise **UP**(`T1`, `B2a`) |
147 |
| - where `B2a` is the greatest closure of `B2` with respect to `X2`, |
148 |
| - as defined in [inference.md]. |
149 |
| - |
150 | 154 | - **UP**(`T Function<...>(...)`, `Function`) = `Function`
|
151 | 155 | - **UP**(`Function`, `T Function<...>(...)`) = `Function`
|
152 | 156 |
|
|
0 commit comments