chipsalliance / chipsalliance/chisel
Type after shift in IntelliJ
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
Maybe this is just a bug in IntelliJ, but let's see if someone has an idea.
**Type of issue**: bug report
Following code
```Scala
val a = 1.U << 1
val b = 3.U
println(a, b)
// IntelliJ editor complains on 'a': Type mismatch, expected UInt, actual: Bits
when(b >= a) {
io.data := 1.U
}
```
displays an error in the IntelliJ editor (a is marked in the when expression). The editor thinks that the shift operation in the first line results in Bits and not a UInt.
However, the code compiles correctly with IntelliJ and also with sbt from the terminal.
What, in the Chisel type system, is confusing the IntelliJ editor here?
**Please tell us about your environment:**
-version 3.1.8
- IntelliJ latest on Mac (just updated)
The example is available here: https://github.com/schoeberl/chisel-playground/blob/master/src/main/scala/issues/Shift.scala
Contributor guide
Assessment
This issue has not been assessed yet.