Skip to content

Remove back-ticked names and add docs #7665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1137,9 +1137,9 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
}
else ctx.getClassIfDefined(clazz.getCanonicalName).typeRef

def `Type_=:=`(self: Type)(that: Type)(given Context): Boolean = self =:= that
def Type_isTypeEq(self: Type)(that: Type)(given Context): Boolean = self =:= that

def `Type_<:<`(self: Type)(that: Type)(given Context): Boolean = self <:< that
def Type_isSubType(self: Type)(that: Type)(given Context): Boolean = self <:< that

/** Widen from singleton type to its underlying non-singleton
* base type by applying one or more `underlying` dereferences,
Expand Down
9 changes: 7 additions & 2 deletions library/src/scala/tasty/reflect/CompilerInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,13 @@ trait CompilerInterface {

def Type_apply(clazz: Class[_])(given ctx: Context): Type

def `Type_=:=`(self: Type)(that: Type)(given ctx: Context): Boolean
def `Type_<:<`(self: Type)(that: Type)(given ctx: Context): Boolean
/** Is `self` type the same as `that` type?
* This is the case iff `Type_isSubType(self, that)` and `Type_isSubType(that, self)`.
*/
def Type_isTypeEq(self: Type)(that: Type)(given ctx: Context): Boolean

/** Is this type a subtype of that type? */
def Type_isSubType(self: Type)(that: Type)(given ctx: Context): Boolean

/** Widen from singleton type to its underlying non-singleton
* base type by applying one or more `underlying` dereferences,
Expand Down
11 changes: 9 additions & 2 deletions library/src/scala/tasty/reflect/TypeOrBoundsOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ trait TypeOrBoundsOps extends Core {
def typeOf[T: scala.quoted.Type]: Type

given TypeOps: (self: Type) {
def =:=(that: Type)(given ctx: Context): Boolean = internal.`Type_=:=`(self)(that)
def <:<(that: Type)(given ctx: Context): Boolean = internal.`Type_<:<`(self)(that)

/** Is `self` type the same as `that` type?
* This is the case iff `self <:< that` and `that <:< self`.
*/
def =:=(that: Type)(given ctx: Context): Boolean = internal.Type_isTypeEq(self)(that)

/** Is this type a subtype of that type? */
def <:<(that: Type)(given ctx: Context): Boolean = internal.Type_isSubType(self)(that)

def widen(given ctx: Context): Type = internal.Type_widen(self)

/** Follow aliases and dereferences LazyRefs, annotated types and instantiated
Expand Down