-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: [SemanticDB] support LambdaType (convert from HKTypeLambda) #16056
Conversation
def flatMap/*<-hk::Monad#flatMap().*/[A/*<-hk::Monad#flatMap().[A]*/, B/*<-hk::Monad#flatMap().[B]*/](m/*<-hk::Monad#flatMap().(m)*/: M/*->hk::Monad#[M]*/[A/*->hk::Monad#flatMap().[A]*/])(f/*<-hk::Monad#flatMap().(f)*/: A/*->hk::Monad#flatMap().[A]*/ => M/*->hk::Monad#[M]*/[B/*->hk::Monad#flatMap().[B]*/]): M/*->hk::Monad#[M]*/[B/*->hk::Monad#flatMap().[B]*/] = ???/*->scala::Predef.`???`().*/ | ||
} | ||
|
||
class EitherMonad/*<-hk::EitherMonad#*/[T/*<-hk::EitherMonad#[T]*/] extends Monad/*->hk::Monad#*/[[E/*<-hk::EitherMonad#`<init>`().[E]*/] =>> Either/*->scala::package.Either#*/[T/*->hk::EitherMonad#[T]*/, E]] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lack of reference recorded for E
when passed to Either
I guess is the usual problem that it is backed by TypeTree
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it seems like so, I'll take a look in another PR :)
hk/hk$package. => final package object hk extends Object { self: hk.type => +4 decls } | ||
hk/hk$package.Id# => type Id [typeparam A ] = A | ||
hk/hk$package.Id#[A] => typeparam A | ||
hk/hk$package.MapKV# => type MapKV [typeparam K ] = [V] =>> Map[K, V] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how a curried type lambda would look with three argument lists, does it nest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it will nest like this https://github.com/lampepfl/dotty/pull/16056/files#diff-18e8342519c9145a646a9b86ca13f58300b3fff458b90420ef3bb7e3e8bdd56fR4005 (force pushed the test)
looks good! |
08fca16
to
399f229
Compare
|
||
type MapV/*<-hk::hk$package.MapV#*/ = [_] =>> [V/*<-hk::hk$package.MapV#[V]*/] =>> Map/*->scala::Predef.Map#*/[String/*->scala::Predef.String#*/, V/*->hk::hk$package.MapV#[V]*/] | ||
|
||
type MapEither/*<-hk::hk$package.MapEither#*/ = [K/*<-hk::hk$package.MapEither#[K]*/] =>> [L/*<-hk::hk$package.MapEither#[L]*/] =>> [R/*<-hk::hk$package.MapEither#[R]*/] =>> Map/*->scala::Predef.Map#*/[K/*->hk::hk$package.MapEither#[K]*/, Either/*->scala::package.Either#*/[L/*->hk::hk$package.MapEither#[L]*/, R/*->hk::hk$package.MapEither#[R]*/]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question for those who know semanticdb the best, should these lambda params after the first list be local symbols? like types in a refinement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so yeah, if they cannot be accessed from the outside these can be local params.
I'm not sure what happened here, sorry! but now it needs another rebase |
9fe0047
to
5e78f68
Compare
Hey, I rebased on the latest |
5e78f68
to
9b678fd
Compare
seems like |
scalameta/scalameta#2867 This commit adds support for LambdaType that is converted from HKTypeLambda in Scala3
based on the new semanticdb schema
scalameta/scalameta#2867
tanishiking/semanticdb-for-scala3@3981424
This commit adds support for LambdaType that is converted from HKTypeLambda in Scala3.
For example, the following type signature
[A, B] =>> [C] =>> A | B | C
will be
I'm wondering...
Previously, we embed
type Id = [A] =>> A
which is equivalent totype Id[A] = A
https://github.com/lampepfl/dotty/blob/afc6ce4d2135e3532bf28146a7700d2cc4338e90/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala#L218-L231
because we didn't have a way to express
[A] =>> A
in SemanticDB.Now we support
LambdaType
in SemanticDB, maybe we can savetype Id[A] = A
astype Id = [A] =>> A
instead of converting it totype Id[A] = A
when converting the signature into SemanticDB. 🤔