mirror of
https://github.com/enso-org/enso.git
synced 2024-11-23 08:08:34 +03:00
Add ascription type information to suggestions database (#9267)
close #9258 Changelog: - fix: add information about the type descriptions to the suggestion database
This commit is contained in:
parent
ba9b7f199a
commit
02bd863c29
@ -702,7 +702,7 @@ final class SuggestionBuilder[A: IndexedSource](
|
||||
* @return the suggestion argument
|
||||
*/
|
||||
private def buildArgument(arg: DefinitionArgument): Suggestion.Argument = {
|
||||
buildTypeSignatureFromMetadata(arg.name.getMetadata(TypeSignatures)) match {
|
||||
buildTypeSignatureFromMetadata(arg.getMetadata(TypeSignatures)) match {
|
||||
case Vector(targ) =>
|
||||
buildTypedArgument(arg, targ)
|
||||
case _ =>
|
||||
|
@ -245,6 +245,80 @@ class SuggestionBuilderTest extends AnyWordSpecLike with Matchers {
|
||||
)
|
||||
}
|
||||
|
||||
"build method with an ascribed argument" in {
|
||||
|
||||
val code =
|
||||
"""import Standard.Base.Data.Text.Text
|
||||
|
|
||||
|foo (a : Text) = 42""".stripMargin
|
||||
val module = code.preprocessModule
|
||||
|
||||
build(code, module) shouldEqual Tree.Root(
|
||||
Vector(
|
||||
ModuleNode,
|
||||
Tree.Node(
|
||||
Suggestion.DefinedMethod(
|
||||
externalId = None,
|
||||
module = "Unnamed.Test",
|
||||
name = "foo",
|
||||
arguments = Seq(
|
||||
Suggestion.Argument(
|
||||
"a",
|
||||
"Standard.Base.Data.Text.Text",
|
||||
false,
|
||||
false,
|
||||
None
|
||||
)
|
||||
),
|
||||
selfType = "Unnamed.Test",
|
||||
returnType = SuggestionBuilder.Any,
|
||||
isStatic = true,
|
||||
documentation = None,
|
||||
annotations = Seq()
|
||||
),
|
||||
Vector()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"build method with an ascribed and default argument" in {
|
||||
|
||||
val code =
|
||||
"""import Standard.Base.Data.Text.Text
|
||||
|
|
||||
|foo (a : Text = "42") = a""".stripMargin
|
||||
val module = code.preprocessModule
|
||||
|
||||
build(code, module) shouldEqual Tree.Root(
|
||||
Vector(
|
||||
ModuleNode,
|
||||
Tree.Node(
|
||||
Suggestion.DefinedMethod(
|
||||
externalId = None,
|
||||
module = "Unnamed.Test",
|
||||
name = "foo",
|
||||
arguments = Seq(
|
||||
Suggestion.Argument(
|
||||
"a",
|
||||
"Standard.Base.Data.Text.Text",
|
||||
false,
|
||||
true,
|
||||
Some("\"42\"")
|
||||
)
|
||||
),
|
||||
selfType = "Unnamed.Test",
|
||||
returnType = SuggestionBuilder.Any,
|
||||
isStatic = true,
|
||||
documentation = None,
|
||||
annotations = Seq()
|
||||
),
|
||||
Vector()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
"build method with a type containing higher kinds" in {
|
||||
|
||||
val code =
|
||||
|
Loading…
Reference in New Issue
Block a user