Skip to content

Commit

Permalink
implement feedback from PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
jcp19 committed May 21, 2024
1 parent 4883590 commit 5dbb6b3
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,22 @@ trait GhostExprTyping extends BaseTyping { this: TypeInfoImpl =>
case PCompositeLit(typ, _) => typ match {
case _: PImplicitSizeArrayType => true
case t: PType => underlyingTypeP(t) match {
case Some(ut) => ut match {
case _: PSliceType | _: PGhostSliceType | _: PMapType => false
case _ => true
case Some(ut: PType with PLiteralType) => ut match {
case g: PGhostLiteralType => g match {
case _: PGhostSliceType => false
case _: PAdtType | _: PDomainType | _: PMathematicalMapType |
_: PMultisetType | _: POptionType | _: PSequenceType | _: PSetType => true
}
case _: PArrayType | _: PStructType => true
case _: PMapType | _: PSliceType => false
case d@(_: PDot | _: PNamedOperand) =>
// underlyingTypeP should never return any of these types
violation(s"Unexpected underlying type $d")
}
case Some(d) =>
// the type system should already have rejected composite literals whose underlying type is not a valid
// literal type.
violation(s"Unexpected underlying type $d")
case None => false
}
}
Expand Down

0 comments on commit 5dbb6b3

Please sign in to comment.