-
Notifications
You must be signed in to change notification settings - Fork 39
Require Fw Types in dictionary #686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
43e8dd9
5f98981
03d05e7
b399757
b4db78a
389772f
8c723a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,33 @@ object CheckUses extends UseAnalyzer { | |
yield a.copy(nestedScope = a.nestedScope.pop) | ||
} | ||
|
||
override def defTopologyAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefTopology]]) = { | ||
a.dictionaryMode match { | ||
case true => { | ||
val impliedTypeUses = List( | ||
"FwChanIdType", | ||
"FwEventIdType", | ||
"FwOpcodeType", | ||
"FwPacketDescriptorType", | ||
"FwTlmPacketizeIdType" | ||
) | ||
val (_, node1, _) = node | ||
val mapping = a.nestedScope.get (NameGroup.Type) _ | ||
for { | ||
a <- Result.foldLeft (impliedTypeUses) (a) ((a, t) => { | ||
for { | ||
symbol <- Result.annotateResult( | ||
helpers.getSymbolForName(mapping)(node1.id, t), | ||
s"Dictionary requires type ${t} to be defined.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add another check here to ensure that the type has an integer type as its underlying type. If not, we can return a TypeError saying that an integer type is required. |
||
} yield a.copy(dictionaryTypeSymbolSet = a.dictionaryTypeSymbolSet + symbol) | ||
}) | ||
a <- super.defTopologyAnnotatedNode(a, node) | ||
} yield a | ||
} | ||
case false => super.defTopologyAnnotatedNode(a, node) | ||
} | ||
} | ||
|
||
override def portUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) = | ||
helpers.visitQualIdentNode (NameGroup.Port) (a, node) | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -19,7 +19,7 @@ sealed trait Error { | |||||
System.err.println("previous occurrence is here:") | ||||||
System.err.println(prevLoc) | ||||||
} | ||||||
|
||||||
/*** Print the error */ | ||||||
def print: Unit = { | ||||||
this match { | ||||||
|
@@ -301,11 +301,16 @@ sealed trait Error { | |||||
case SemanticError.UseDefCycle(loc, msg) => Error.print (Some(loc)) (msg) | ||||||
case XmlError.ParseError(file, msg) => Error.printXml (file) (msg) | ||||||
case XmlError.SemanticError(file, msg) => Error.printXml (file) (msg) | ||||||
case AnnotatedError(error, note) => | ||||||
error.print | ||||||
System.err.println(s"note: ${note}") | ||||||
} | ||||||
} | ||||||
|
||||||
} | ||||||
|
||||||
/** Annotated error for including additional notes */ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
final case class AnnotatedError(error: Error, note: String) extends Error | ||||||
/** A syntax error */ | ||||||
final case class SyntaxError(loc: Location, msg: String) extends Error | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this variable to be a predicate: