chisel
                                
                                
                                
                                    chisel copied to clipboard
                            
                            
                            
                        [Scala3] Redux: Convert cloneType to an extension method
Redux of #3771. Turns out we need this for Scala3 after all
Ran into errors related to this while adding Scala3 cross-compilation support. Here's a sample of what an error with Dotty looks like:
[error] -- [E007] Type Mismatch Error: chisel3/core/src/main/scala/chisel3/AggregateImpl.scala:838:4 
[error] 838 |    clone
[error]     |    ^^^^^
[error]     |    Found:    (clone : chisel3.Record & chisel3.RecordImpl)
[error]     |    Required: (RecordImpl.this : chisel3.Record & chisel3.RecordImpl)
I suspect this is due to the tightening of the type system in Scala3, specifically changes which make this.type a more stricter representation of the current instance. I think this SIP might have a more detailed specification of the related changes: https://docs.scala-lang.org/sips/42.type.html#related-scala-issues-resolved-by-the-literal-types-implementation
Contributor Checklist
- [ ] Did you add Scaladoc to every public function/method?
 - [ ] Did you add at least one test demonstrating the PR?
 - [ ] Did you delete any extraneous printlns/debugging code?
 - [ ] Did you specify the type of improvement?
 - [ ] Did you add appropriate documentation in 
docs/src? - [ ] Did you request a desired merge strategy?
 - [ ] Did you add text to be included in the Release Notes for this change?
 
Type of Improvement
- API Modification
 - Internal or build-related (includes code refactoring/cleanup)
 
Desired Merge Strategy
- Squash: The PR will be squashed and merged (choose this if you have no preference).
 
Release Notes
Move cloneType to an extension method in preparation for Scala3
Reviewer Checklist (only modified by reviewer)
- [ ] Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
 - [ ] Did you mark the proper milestone (Bug fix: 
3.6.x,5.x, or6.xdepending on impact, API modification or big change:7.0)? - [ ] Did you review?
 - [ ] Did you check whether all relevant Contributor checkboxes have been checked?
 - [ ] Did you do one of the following when ready to merge:
- [ ] Squash: You/ the contributor 
Enable auto-merge (squash), clean up the commit message, and label withPlease Merge. - [ ] Merge: Ensure that contributor has cleaned up their commit history, then merge with 
Create a merge commit. 
 - [ ] Squash: You/ the contributor