Skip to content

Commit 07d4185

Browse files
committed
an annotation can reference a non-simple type, fixes #24
1 parent ab1ef7e commit 07d4185

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

compile/api/SameAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class SameAPI(tagsA: TypeVars, tagsB: TypeVars, includePrivate: Boolean, include
211211
def sameAnnotations(a: Seq[Annotation], b: Seq[Annotation]): Boolean =
212212
sameSeq(a, b)(sameAnnotation)
213213
def sameAnnotation(a: Annotation, b: Annotation): Boolean =
214-
debug(sameSimpleType(a.base, b.base), "Annotation base type differed") &&
214+
debug(sameType(a.base, b.base), "Annotation base type differed") &&
215215
debug(sameAnnotationArguments(a.arguments, b.arguments), "Annotation arguments differed (" + a + ") and (" + b + ")")
216216
def sameAnnotationArguments(a: Seq[AnnotationArgument], b: Seq[AnnotationArgument]): Boolean =
217217
argumentMap(a) == argumentMap(b)

compile/api/ShowAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ trait ShowTypes
214214
// don't show inherited to avoid dealing with cycles
215215
concat(s.parents, t, " with ") + "\n{\n" + lines(s.declared, d) + "\n}"
216216
}
217-
implicit def showAnnotated(implicit as: Show[Annotation], t: Show[SimpleType]): Show[Annotated] =
217+
implicit def showAnnotated(implicit as: Show[Annotation], t: Show[Type]): Show[Annotated] =
218218
new Show[Annotated] { def show(a: Annotated) = spaced(a.annotations, as) + " " + t.show(a.baseType) }
219219
implicit def showProjection(implicit t: Show[SimpleType]): Show[Projection] =
220220
new Show[Projection] { def show(p: Projection) = t.show(p.prefix) + "#" + p.id }

compile/interface/API.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ final class API(val global: Global, val callback: xsbti.AnalysisCallback) extend
132132

133133
private def annotations(in: Symbol, as: List[AnnotationInfo]): Array[xsbti.api.Annotation] = as.toArray[AnnotationInfo].map(annotation(in,_))
134134
private def annotation(in: Symbol, a: AnnotationInfo) =
135-
new xsbti.api.Annotation(simpleType(in, a.atp),
135+
new xsbti.api.Annotation(processType(in, a.atp),
136136
if(a.assocs.isEmpty) Array(new xsbti.api.AnnotationArgument("", a.args.mkString("(", ",", ")"))) // what else to do with a Tree?
137137
else a.assocs.map { case (name, value) => new xsbti.api.AnnotationArgument(name.toString, value.toString) }.toArray[xsbti.api.AnnotationArgument]
138138
)

compile/persist/APIFormats.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ trait APIFormats extends FormatExtra
103103
p7( (td: TypeDeclaration) => (td.lowerBound, td.upperBound, td.typeParameters, td.name, td.access, td.modifiers, td.annotations))( new TypeDeclaration(_,_,_,_,_,_,_))(t,t,tps,n,acs,ms,ans)
104104

105105
// cyclic with SimpleType
106-
def formatAnnotation(implicit t: Format[SimpleType], af: Format[Array[AnnotationArgument]]): Format[Annotation] =
106+
def formatAnnotation(implicit t: Format[Type], af: Format[Array[AnnotationArgument]]): Format[Annotation] =
107107
p2( (a: Annotation) => (a.base, a.arguments) )( (a,b) => new Annotation(a,b) )(t, af)
108108

109109
implicit def formatAnnotationArgument(implicit sf: Format[String]): Format[AnnotationArgument] =
@@ -209,9 +209,9 @@ class DefaultAPIFormats(implicit val references: References) extends APIFormats
209209
implicit lazy val df: Format[Definition] = lazyFormat( formatDefinition )
210210

211211
// Projection, Annotation, and Parameterized are cyclic with SimpleType
212-
// Parameterized is also cyclic with Type
212+
// Parameterized and Annotation are also cyclic with Type
213213
implicit lazy val projf: Format[Projection] = formatProjection(stf, ??)
214-
implicit lazy val af: Format[Annotation] = formatAnnotation(stf, ??)
214+
implicit lazy val af: Format[Annotation] = formatAnnotation(tf, ??)
215215
implicit lazy val paramf: Format[Parameterized] = formatParameterized(stf, array(tf))
216216

217217
// Super and Path are cyclic

interface/other

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TypeParameter
3636
upperBound: Type
3737

3838
Annotation
39-
base: SimpleType
39+
base: Type
4040
arguments: AnnotationArgument*
4141
AnnotationArgument
4242
name: String

0 commit comments

Comments
 (0)