File tree 2 files changed +58
-1
lines changed
compiler/src/dotty/tools/dotc/util
presentation-compiler/test/dotty/tools/pc/tests/signaturehelp
2 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import core.NameKinds
13
13
import core .Types ._
14
14
import core .Symbols .NoSymbol
15
15
import interactive .Interactive
16
+ import transform .SymUtils .isLocalToBlock
16
17
import util .Spans .Span
17
18
import reporting ._
18
19
@@ -178,7 +179,8 @@ object Signatures {
178
179
(alternativeIndex, alternatives)
179
180
case _ =>
180
181
val funSymbol = fun.symbol
181
- val alternatives = funSymbol.owner.info.member(funSymbol.name).alternatives
182
+ val alternatives = if funSymbol.isLocalToBlock then List (funSymbol.denot) else
183
+ funSymbol.owner.info.member(funSymbol.name).alternatives
182
184
val alternativeIndex = alternatives.map(_.symbol).indexOf(funSymbol) max 0
183
185
(alternativeIndex, alternatives)
184
186
Original file line number Diff line number Diff line change @@ -702,3 +702,58 @@ class SignatureHelpSuite extends BaseSignatureHelpSuite:
702
702
| ^^^^^^^^^^^
703
703
|""" .stripMargin
704
704
)
705
+
706
+ @ Test def `local-method` =
707
+ check(
708
+ """
709
+ |object Main {
710
+ | def foo() = {
711
+ | def deployment(
712
+ | fst: String,
713
+ | snd: Int = 1,
714
+ | ): Option[Int] = ???
715
+ | val abc = deployment(@@)
716
+ | }
717
+ |}
718
+ |""" .stripMargin,
719
+ """ |deployment(fst: String, snd: Int): Option[Int]
720
+ | ^^^^^^^^^^^
721
+ |""" .stripMargin,
722
+ )
723
+
724
+ @ Test def `local-method2` =
725
+ check(
726
+ """
727
+ |object Main {
728
+ | val foo = {
729
+ | def deployment(
730
+ | fst: String,
731
+ | snd: Int = 1,
732
+ | ): Option[Int] = ???
733
+ | deployment(@@)
734
+ | }
735
+ |}
736
+ |""" .stripMargin,
737
+ """ |deployment(fst: String, snd: Int): Option[Int]
738
+ | ^^^^^^^^^^^
739
+ |""" .stripMargin,
740
+ )
741
+
742
+ @ Test def `local-method3` =
743
+ check(
744
+ """
745
+ |object Main {
746
+ | def foo = {
747
+ | object a {
748
+ | def apply(a: Int): Int = a
749
+ | def apply(b: String): String = b
750
+ | a(""@@)
751
+ | }
752
+ | }
753
+ |}
754
+ |""" .stripMargin,
755
+ """ |apply(b: String): String
756
+ | ^^^^^^^^^
757
+ |apply(a: Int): Int
758
+ |""" .stripMargin
759
+ )
You can’t perform that action at this time.
0 commit comments