scala3
scala3 copied to clipboard
feat: [SemanticDB] support LambdaType (convert from HKTypeLambda)
based on the new semanticdb schema https://github.com/scalameta/scalameta/pull/2867 https://github.com/tanishiking/semanticdb-for-scala3/commit/3981424f2eee9b03e6114b21026572f877185638
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
LambdaType(
parameters = Some(
value = Scope(hardlinks =
List(
"....Union#[A]"
"....Union#[B]"
), symlinks = List()
)
),
returnType = LambdaType(
parameters = Some(
value = Scope(hardlinks = List("....Union#[C]"), symlinks = List())
),
returnType = UnionType(
types = List(
TypeRef(
prefix = Empty,
symbol = "....Union#[A]",
typeArguments = List()
),
TypeRef(
prefix = Empty,
symbol = "....Union#[B]",
typeArguments = List()
),
TypeRef(
prefix = Empty,
symbol = "....Union#[C]",
typeArguments = List()
)
)
)
)
)
I'm wondering...
Previously, we embed type Id = [A] =>> A which is equivalent to type 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 save type Id[A] = A as type Id = [A] =>> A instead of converting it to type Id[A] = A when converting the signature into SemanticDB. 🤔
looks good!
I'm not sure what happened here, sorry! but now it needs another rebase
Hey, I rebased on the latest main 👍
seems like tests/neg-custom-args/fatal-warnings/i15503g.scala is now failing the tests with some unused parameters warnings