Skip to content

Commit 23d01e5

Browse files
committed
Address review comments
1 parent 56893de commit 23d01e5

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

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

+9-5
Original file line numberDiff line numberDiff line change
@@ -2651,12 +2651,13 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
26512651
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags | dotc.core.Flags.Case, tpe)
26522652

26532653
def newTypeAlias(owner: Symbol, name: String, flags: Flags, tpe: TypeRepr, privateWithin: Symbol): Symbol =
2654-
checkValidFlags(flags.toTypeFlags, Flags.validTypeFlags)
2654+
checkValidFlags(flags.toTypeFlags, Flags.validTypeAliasFlags)
2655+
assert(tpe.isInstanceOf[Types.TypeBounds], "Passed `tpe` into newTypeAlias should not represent TypeBounds")
26552656
dotc.core.Symbols.newSymbol(owner, name.toTypeName, flags | dotc.core.Flags.Deferred, dotc.core.Types.TypeAlias(tpe), privateWithin)
26562657

26572658
def newBoundedType(owner: Symbol, name: String, flags: Flags, tpe: TypeBounds, privateWithin: Symbol): Symbol =
2658-
checkValidFlags(flags.toTypeFlags, Flags.validTypeFlags)
2659-
dotc.core.Symbols.newSymbol(owner, name.toTypeName, flags | dotc.core.Flags.Deferred, tpe, privateWithin)
2659+
checkValidFlags(flags.toTypeFlags, Flags.validBoundedTypeFlags)
2660+
dotc.core.Symbols.newSymbol(owner, name.toTypeName, flags, tpe, privateWithin)
26602661

26612662
def noSymbol: Symbol = dotc.core.Symbols.NoSymbol
26622663

@@ -2999,8 +3000,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
29993000
// Keep: aligned with Quotes's `newBind` doc
30003001
private[QuotesImpl] def validBindFlags: Flags = Case // Flags that could be allowed: Implicit | Given | Erased
30013002

3002-
// Keep: aligned with Quotes's 'newType' doc
3003-
private[QuotesImpl] def validTypeFlags: Flags = Private | Protected | Override | Deferred | Final | Infix | Local
3003+
// Keep: aligned with Quotes's 'newBoundedType' doc
3004+
private[QuotesImpl] def validBoundedTypeFlags: Flags = Private | Protected | Override | Deferred | Final | Infix | Local
3005+
3006+
// Keep: aligned with Quotes's `newTypeAlias` doc
3007+
private[QuotesImpl] def validTypeAliasFlags: Flags = Private | Protected | Override | Final | Infix | Local
30043008

30053009
end Flags
30063010

library/src/scala/quoted/Quotes.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -3971,14 +3971,14 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
39713971
*
39723972
* @param parent The owner of the type
39733973
* @param name The name of the type
3974-
* @param flags extra flags to with which symbol can be constructed. `Deferred` flag will be added. Can be `Private` | `Protected` | `Override` | `Deferred` | `Final` | `Infix` | `Local`
3974+
* @param flags extra flags to with which symbol can be constructed. Can be `Private` | `Protected` | `Override` | `Final` | `Infix` | `Local`
39753975
* @param tpe The rhs the type alias
3976-
* @param privateWithin the symbol within which this new method symbol should be private. May be noSymbol.
3976+
* @param privateWithin the symbol within which this new type symbol should be private. May be noSymbol.
39773977
* @note As a macro can only splice code into the point at which it is expanded, all generated symbols must be
39783978
* direct or indirect children of the reflection context's owner.
39793979
*/
39803980
@experimental
3981-
// Keep: `flags` doc aligned with QuotesImpl's `validTypeFlags`
3981+
// Keep: `flags` doc aligned with QuotesImpl's `validTypeAliasFlags`
39823982
def newTypeAlias(parent: Symbol, name: String, flags: Flags, tpe: TypeRepr, privateWithin: Symbol): Symbol
39833983

39843984
/** Generate a new type symbol for a type bounds with the given parent, name and type
@@ -3991,12 +3991,12 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
39913991
* @param name The name of the type
39923992
* @param flags extra flags to with which symbol can be constructed. `Deferred` flag will be added. Can be `Private` | `Protected` | `Override` | `Deferred` | `Final` | `Infix` | `Local`
39933993
* @param tpe The bounds of the type
3994-
* @param privateWithin the symbol within which this new method symbol should be private. May be noSymbol.
3994+
* @param privateWithin the symbol within which this new type symbol should be private. May be noSymbol.
39953995
* @note As a macro can only splice code into the point at which it is expanded, all generated symbols must be
39963996
* direct or indirect children of the reflection context's owner.
39973997
*/
39983998
@experimental
3999-
// Keep: `flags` doc aligned with QuotesImpl's `validTypeFlags`
3999+
// Keep: `flags` doc aligned with QuotesImpl's `validBoundedTypeFlags`
40004000
def newBoundedType(parent: Symbol, name: String, flags: Flags, tpe: TypeBounds, privateWithin: Symbol): Symbol
40014001

40024002
/** Definition not available */

0 commit comments

Comments
 (0)