-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Support seq<trait> in C# #557
feat!: Support seq<trait> in C# #557
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with DafnyRuntimeTests that makes them difficult to include at this time?
Some more tests of some compile code would be good. Also, it would be good to include that example (which I think sits somewhere in the test suite) that has the comment that says "this would be expensive to support at run time", to make sure it compiles correctly (to efficient code).
Binaries/DafnyRuntime.cs
Outdated
Type ty = typeof(G); | ||
// TODO-RS: How to generalize this? | ||
if (ty.Name.Equals("ISequence`1")) { | ||
Type classType = Type.GetType("Dafny.Sequence`1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the type Dafny.Sequence`1
always in the run time? If so, can its type be looked up with a typeof
instead of by name? Also, is the `1
suffix unavoidable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is super-sloppy and needs to be cleaned up. ISequence`1
is shorthand for "The ISequence
type that takes one type parameter" (since C# allows overloading by number of type parameters). It's just a little tricky because I need to map from Dafny.ISequence<x>
to Dafny.Sequence<x>
, where x is a concrete type rather than the generic type parameter T
, and I'm still learning the C# reflection model. I know how to do it in Java! :)
I hadn't intended this to be ready for review yet, I wanted to check that all tests passed on CodeBuild before I added a lot of new ones. Perhaps I should have put (draft PR don't review yet) in the title. :) Appreciate the eyes on it all the same though!
Nothing fundamental, it'll just be extra work to have the build process run C# tests as well as the lit tests. I initially created this just to validate my assumptions about the
Agreed, working on the explicit tests now. You're referring to |
My mistake, that test happens to only cover |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
seq<trait>
in C#
Ready for review now - interested in feedback on whether existing regression tests and the added case in |
Things look good. I think the one test in RuntimeTypeTests0.dfy is fine, since it mostly serves as a comparison with Datatype and set, which don't yet have this support. However, I do think that adding a run-time checked example would be appropriate, since the PR changes the run-time representation of sequences. (Note that, despite the /compile:3 flag and the Main method in this example, nothing gets executed because of the compiler errors.) Such tests would go well in Test/comp, where they could test the seq functionality for all target compilers. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…-of-trait-in-csharp
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Addresses #406 for C# only.
See comments in
Test/dafny0/RuntimeTypeTests0.dfy
for details.BREAKING CHANGE: Sequences are now represented by a
Dafny.ISequence<T>
interface, which will break external code.