Skip to content

Commit c3a1aef

Browse files
[Scala3] Add support for Selectable Modules (#5087)
1 parent 13da5f5 commit c3a1aef

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

core/src/main/scala-2/chisel3/SelectableCompat.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22

33
package chisel3
44

5-
/** Does nothing in Scala 2; this stub trait is for maintaining
6-
* compatibility with Scala 3's selectable, required to support
7-
* structurally-typed Bundles in Scala 3.
5+
/** Shim for Scala 3's `scala.reflect.Selectable`
6+
*
7+
* Allows Chisel to cross-compile Scala 2 and Scala 3
8+
* while enabling structural typing in Scala 3.
9+
*/
10+
trait ReflectSelectable
11+
12+
/** Shim for Scala 3's `scala.Selectable`
13+
*
14+
* Allows Chisel to cross-compile Scala 2 and Scala 3
15+
* while enabling structural typing in Scala 3.
816
*/
917
trait Selectable
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
3+
package chisel3
4+
5+
type ReflectSelectable = scala.reflect.Selectable

core/src/main/scala/chisel3/Module.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ package experimental {
413413
/** Abstract base class for Modules, an instantiable organizational unit for RTL.
414414
*/
415415
// TODO: seal this?
416-
abstract class BaseModule extends HasId with IsInstantiable {
416+
abstract class BaseModule extends HasId with IsInstantiable with ReflectSelectable {
417417
_parent.foreach(_.addId(this))
418418

419419
// Set if the returned top-level module of a nested call to the Chisel Builder, see Definition.apply

0 commit comments

Comments
 (0)