Skip to content

Error when calling .viewAs on non-hardware#3398

Merged
jackkoenig merged 3 commits intomainfrom
require-dataview-target-be-hardware
Jun 29, 2023
Merged

Error when calling .viewAs on non-hardware#3398
jackkoenig merged 3 commits intomainfrom
require-dataview-target-be-hardware

Conversation

@jackkoenig
Copy link
Contributor

Based on #3395 and should be merged afterward

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

Desired Merge Strategy

  • Squash

Release Notes

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.5.x, 3.6.x, or 5.x depending on impact, API modification or big change: 6.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 with Please Merge.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

It's an error in most cases already, and in the cases it isn't, make it
a warning. Also fix a crash that could occur when viewing a non-Data
containing non-hardware Data.
This was previously deprecated, and in most cases results in an error
downstream anyway.
@jackkoenig jackkoenig added this to the 6.0 milestone Jun 29, 2023
@jackkoenig jackkoenig requested a review from seldridge June 29, 2023 22:10
new DataView[T, V2](
t => g.mkView(mkView(t)),
{ case (t, v2) => List(t.viewAs[V](tdp, self).viewAs[V2](vdp, g) -> v2) },
{ case (t, v2) => List(t.viewAs[V].viewAs[V2] -> v2) },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I added source info as an implicit argument to .viewAs it told me I need to pass it explicitly here (which is true) but I realized that it would be simpler just to mark the two DataViews as implicit. When I originally wrote this I think I thought there would be ambiguity issues with the implicit DataViews but there obviously isn't because they are of different types. I added the type annotations just to make it more clear.

@jackkoenig jackkoenig enabled auto-merge (squash) June 29, 2023 22:36
@jackkoenig jackkoenig changed the title Require target of .viewAs be hardware Error when calling .viewAs on non-hardware Jun 29, 2023
@jackkoenig jackkoenig merged commit 241d424 into main Jun 29, 2023
@jackkoenig jackkoenig deleted the require-dataview-target-be-hardware branch June 29, 2023 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants