Conversation
| * @param mapping a sequence to search of keys and values | ||
| * @return the value found or the default if not | ||
| */ | ||
| def fromEnum[S <: EnumType, T <: Data](key: S, default: T, mapping: Seq[(S, T)]): T = { |
There was a problem hiding this comment.
what happens if you try to overload the apply function? Does the Scala compiler complain?
There was a problem hiding this comment.
I get a compile error method apply is defined twice. https://scastie.scala-lang.org/eO18f45oQgKIi2GiBhMNYg
There was a problem hiding this comment.
We're successfully overloading apply now 🙂 see #3095
|
Thanks @albertchen-sifive! Would you mind adding a short code example to how to use this new method in the docstring? |
|
I realized I got the order of operations wrong. I want to also make a PR to fix this issue #2780 (improving the signature of |
Either order is fine with me! It makes sense to me to only add this new method with the way we want to have the signature in the end. |
Contributor Checklist
docs/src?Type of Improvement
API Impact
adds
chisel3.util.MuxLookup.fromEnumBackend Code Generation Impact
none
Desired Merge Strategy
Squash
Release Notes
add
chisel3.util.MuxLookup.fromEnumReviewer Checklist (only modified by reviewer)
3.5.xor3.6.xdepending on impact, API modification or big change:5.0.0)?Enable auto-merge (squash), clean up the commit message, and label withPlease Merge.Create a merge commit.