Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #173 from sschaef/issue/semantic-highlight-paramet…

…erized-types

Fix for ticket #1001198
  • Loading branch information...
commit 86fb98ff9bfd00b96970f5167949d325e1eadf84 2 parents 2c9c6f7 + f6cfbb0
Mirco Dotta authored
42  ...scala-ide.sdt.core.tests/src/scala/tools/eclipse/semantichighlighting/classifier/TypeParameterTest.scala
@@ -28,4 +28,46 @@ class TypeParameterTest extends AbstractSymbolClassifierTest {
28 28
       }""",
29 29
       Map("TPARAM" -> TypeParameter))
30 30
   }
  31
+
  32
+  @Test
  33
+  def parameterized_type_param() {
  34
+    checkSymbolClassification("""
  35
+      trait X {
  36
+        def xs[TypeParam]: Seq[TypeParam]
  37
+      }
  38
+      """, """
  39
+      trait X {
  40
+        def xs[$TPARAM $]: $T$[$TPARAM $]
  41
+      }
  42
+      """,
  43
+      Map("TPARAM" -> TypeParameter, "T" -> Type))
  44
+  }
  45
+
  46
+  @Test
  47
+  def nested_parameterized_type_param() {
  48
+    checkSymbolClassification("""
  49
+      trait X {
  50
+        def xs[TypeParam]: Seq[Seq[TypeParam]]
  51
+      }
  52
+      """, """
  53
+      trait X {
  54
+        def xs[$TPARAM $]: $T$[$T$[$TPARAM $]]
  55
+      }
  56
+      """,
  57
+      Map("TPARAM" -> TypeParameter, "T" -> Type))
  58
+  }
  59
+
  60
+  @Test
  61
+  def multiple_parameterized_type_param() {
  62
+    checkSymbolClassification("""
  63
+      trait X {
  64
+        def xs[TypeParam]: Map[TypeParam, Seq[TypeParam]]
  65
+      }
  66
+      """, """
  67
+      trait X {
  68
+        def xs[$TPARAM $]: $T$[$TPARAM $, $T$[$TPARAM $]]
  69
+      }
  70
+      """,
  71
+      Map("TPARAM" -> TypeParameter, "T" -> Type))
  72
+  }
31 73
 }
3  org.scala-ide.sdt.core/src/scala/tools/eclipse/semantichighlighting/classifier/SafeSymbol.scala
@@ -76,6 +76,9 @@ trait SafeSymbol extends CompilerAccess with PimpedTrees {
76 76
         else List((sym1, pos))
77 77
       }).flatten
78 78
 
  79
+    case AppliedTypeTree(tpe, args) =>
  80
+      tpe.symbol -> tpe.namePosition :: args.flatMap(safeSymbol)
  81
+
79 82
     case _ =>
80 83
       // the local variable backing a lazy value is called 'originalName$lzy'. We swap it here for its
81 84
       // accessor, otherwise this symbol would fail the test in `getNameRegion`

0 notes on commit 86fb98f

Please sign in to comment.
Something went wrong with that request. Please try again.