Skip to content

Commit

Permalink
fixup! [FIRRTL] Parse Layer-Associated Probes
Browse files Browse the repository at this point in the history
  • Loading branch information
seldridge committed Jan 12, 2024
1 parent df24717 commit dea1a8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Dialect/FIRRTL/Import/FIRParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,14 +942,16 @@ ParseResult FIRParser::parseType(FIRRTLType &result, const Twine &message) {
return failure();
while (getToken().getKind() == FIRToken::identifier) {
StringRef layer;
if (parseId(layer, "expected layer name"))
return failure();
loc = getToken().getLoc();
(void)parseId(layer, "expected layer name");
layers.push_back(layer);
if (getToken().getKind() == FIRToken::period)
consumeToken();
}
if (parseToken(FIRToken::greater, "expected '>' in reference type"))
if (!consumeIf(FIRToken::greater)) {
emitError(loc, "expected '>' to end reference type");
return failure();
}

bool forceable = kind == FIRToken::kw_RWProbe;

Expand Down
8 changes: 8 additions & 0 deletions test/Dialect/FIRRTL/parse-errors.fir
Original file line number Diff line number Diff line change
Expand Up @@ -1246,3 +1246,11 @@ circuit Foo:
option Platform:
FPGA
FPGA

;// -----
FIRRTL version 4.0.0
circuit Foo:
layer A bind:
module Foo:
; expected-error @below {{expected '>' to end reference type}}
output a: Probe<UInt<1>

0 comments on commit dea1a8e

Please sign in to comment.