Skip to content

Commit a679d6c

Browse files
committed
Fix errors; update documents
1 parent 6b80f37 commit a679d6c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ object Types extends TypeUtils {
7777
* | +- TypeVar
7878
* | +- HKTypeLambda
7979
* | +- MatchType
80+
* | +- FlexibleType
8081
* |
8182
* +- GroundType -+- AndType
8283
* +- OrType
@@ -3468,7 +3469,7 @@ object Types extends TypeUtils {
34683469
* `T | Null .. T`, so that `T | Null <: FlexibleType(T) <: T`.
34693470
* A flexible type will be erased to its original type `T`.
34703471
*/
3471-
case class FlexibleType(lo: Type, hi: Type) extends CachedProxyType with ValueType {
3472+
case class FlexibleType protected(lo: Type, hi: Type) extends CachedProxyType with ValueType {
34723473

34733474
override def underlying(using Context): Type = hi
34743475

@@ -3481,7 +3482,7 @@ object Types extends TypeUtils {
34813482
}
34823483

34833484
object FlexibleType {
3484-
def apply(tp: Type)(using Context): Type = tp match {
3485+
def apply(tp: Type)(using Context): FlexibleType = tp match {
34853486
case ft: FlexibleType => ft
34863487
case _ =>
34873488
// val tp1 = tp.stripNull()

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,17 +2345,15 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
23452345

23462346
type FlexibleType = dotc.core.Types.FlexibleType
23472347

2348-
object FlexibleTypeTest extends TypeTest[TypeRepr, FlexibleType]:
2348+
object FlexibleTypeTypeTest extends TypeTest[TypeRepr, FlexibleType]:
23492349
def unapply(x: TypeRepr): Option[FlexibleType & x.type] = x match
23502350
case x: (Types.FlexibleType & x.type) => Some(x)
23512351
case _ => None
2352-
end FlexibleTypeTest
2352+
end FlexibleTypeTypeTest
23532353

23542354
object FlexibleType extends FlexibleTypeModule:
2355-
def apply(tp: TypeRepr): FlexibleType =
2356-
// why object FlexibleType.apply(Type) is not found here?
2357-
Types.FlexibleType(tp, tp)
2358-
def unapply(x: FlexibleType): TypeRepr = x.hi
2355+
def apply(tp: TypeRepr): FlexibleType = Types.FlexibleType(tp)
2356+
def unapply(x: FlexibleType): Some[TypeRepr] = Some(x.hi)
23592357
end FlexibleType
23602358

23612359
type Constant = dotc.core.Constants.Constant

library/src/scala/quoted/Quotes.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
211211
* +- MatchCase
212212
* +- TypeBounds
213213
* +- NoPrefix
214+
* +- FlexibleType
214215
*
215216
* +- MethodTypeKind -+- Contextual
216217
* +- Implicit
@@ -3442,7 +3443,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
34423443
/** Methods of the module object `val FlexibleType` */
34433444
trait FlexibleTypeModule { this: FlexibleType.type =>
34443445
def apply(tp: TypeRepr): FlexibleType
3445-
def unapply(x: FlexibleType): TypeRepr
3446+
def unapply(x: FlexibleType): Option[TypeRepr]
34463447
}
34473448

34483449
///////////////

0 commit comments

Comments
 (0)