Type after shift in IntelliJ
See original GitHub issueMaybe this is just a bug in IntelliJ, but let’s see if someone has an idea.
Type of issue: bug report
Following code
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
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
IntelliJ IDEA keyboard shortcuts - JetBrains
Press Ctrl+Shift+A and start typing to get a list of suggested actions. Then select the necessary action and press Enter to execute it....
Read more >Keyboard shortcuts: keymaps comparison (Windows) - JetBrains
Basic editing ; Join Lines. Ctrl+Shift+J · Ctrl+Shift+J · Ctrl+Shift+J ; Duplicate Line or Selection. Ctrl+D · Ctrl+D · Ctrl+D.
Read more >Top 15 IntelliJ IDEA Shortcuts - The JetBrains Blog
⌥↑ / ⌥↓ or Ctrl + W / Shift + Ctrl + W ... We can select increasing or decreasing sections of code...
Read more >Troubleshooting problems with keyboard shortcuts - JetBrains
Press Ctrl+Alt+S to open the IDE settings and select Keymap. Make sure that you are using the correct keymap. Use the search field...
Read more >Configure keyboard shortcuts | IntelliJ IDEA Documentation
For example, you can press Ctrl+Shift+A and type the name of the Jump to Colors and Fonts action to quickly modify the color...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Implicit conversions: there’s been some discussion on making the separation of Bits and UInt better, so it might not be safe to have Bits automatically cast to UInt.
I think a typeclass solution on Bits makes sense, and I remember hearing that having macros change the return type was discouraged and may go away in a future Scala version. One caveat here is that it needs to not bleed into the user facing API (this is what prevented a typeclass approach to static-typed literals - it would have required something like
MyBundle extends Bundle with StaticLiteral[MyBundle]
), but since this only affects the Bits hierarchy (which we don’t expect users to extend), that shouldn’t be a problemBTW, the same issue is true with Eclipse 😦
And another example:
on blkReg := ~blkReg it complains with a type mismatch.