Skip to content

Commit cf2cf9d

Browse files
authored
Merge pull request #16 from BotTech/fix/package-members
Fix package members
2 parents d16721c + abec99d commit cf2cf9d

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

core/src/main/scala/nz/co/bottech/scala2plantuml/DiagramModifications.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ private[scala2plantuml] object DiagramModifications {
144144
assert(names.isEmpty)
145145
def typeParameterSymbols(parameters: Seq[TypeParameter]): Seq[String] =
146146
parameters.flatMap(parameter => parameter.symbol +: parameter.parentSymbols)
147-
// TODO: This might be overkill. All the symbols we care about should be types.
148147
def elementSymbols(element: ClassDiagramElement): Seq[String] =
149148
element match {
150149
case typ: Type => typ.symbol +: typ.parentSymbols ++: typeParameterSymbols(typ.typeParameters)
@@ -161,8 +160,8 @@ private[scala2plantuml] object DiagramModifications {
161160
symbolName(parameter.symbol) +: parameter.parentSymbols.map(symbolName)
162161
}
163162
elementName +: typeParameterNames
164-
case member: Member => Seq(member.symbol -> member.displayName)
165-
case _: Aggregation => Seq.empty
163+
case member: Member => Seq(member.symbol -> member.displayName)
164+
case aggregation: Aggregation => Seq(symbolName(aggregation.aggregator), symbolName(aggregation.aggregated))
166165
}
167166
}
168167
val newNames = options.naming match {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package nz.co.bottech.scala2plantuml
2+
3+
import utest.{test, TestSuite, Tests}
4+
5+
object MethodParameterTests extends TestSuite with ClassDiagramTests {
6+
7+
override protected val exampleDir: String = "methodparameters"
8+
9+
val tests: Tests = Tests {
10+
test("parameter with type alias") {
11+
success(
12+
"Foo.",
13+
"""class Foo {
14+
| + {static} {method} foo
15+
|}
16+
|Foo o-- "package$Bar"""".stripMargin
17+
)
18+
}
19+
}
20+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package nz.co.bottech.scala2plantuml.examples.methodparameters
2+
3+
object Foo {
4+
5+
def foo(bar: Bar): String = bar
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package nz.co.bottech.scala2plantuml.examples
2+
3+
package object methodparameters {
4+
5+
type Bar = String
6+
}

0 commit comments

Comments
 (0)