Skip to content
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

Chore: Dafny to Rust refactorings #5513

Merged
merged 29 commits into from
Jun 22, 2024
Merged

Chore: Dafny to Rust refactorings #5513

merged 29 commits into from
Jun 22, 2024

Conversation

MikaelMayer
Copy link
Member

  • extern module as attribute
  • Type arguments with type bounds
  • Attributes handling
  • Type on Select field and TupleSelect
  • Name refactoring to ensure we distinguish Dafny names from Rust names
  • Binary In operator
  • NoStatementBuffer to convert
  • GenFormals
  • EmitNameAndActualTypeArgs (for classes)
  • ParseAttributes
  • GetExtractOverrideName (to be able to model Rust options) Dafny
  • StructBuild first argument to be an expression instead of a string
  • Apply split into Apply for expressions and ApplyType for type arguments
  • Conversion from Type to TypeParamDecl so that we can support bounds
  • Changed Formals to Fields, and NamelessFormals to NamelessFields
  • Visibility has its own datatype
  • Renamed Self to SelfBorrowed
  • Renamed SeltMut to SelfBorrowedMut
  • Box/BoxNew (for attribute annotations)
  • Support for native bool
  • ToOwned (used in tail recursion)
  • IsImmutableConversion
  • Formal.self becomes Formal.selfBorrowed
  • Formal.selfMut becomes Formal.selfBorrowedMut
  • AssignMember and all new variants ExtractTuple and Index
  • ExprFromType to be able to simulate macros like expressions
  • Lambda (makes code prettier)
  • Error handling
  • Debug trait for datatypes
  • No more system object, just std::any::Any
  • New char encoding
  • int! macro
  • Refactoring of DafatypeValue's first argument
  • constant
  • GenIdent refactoring

How has this been tested?

Existing tests should just pass.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

MikaelMayer and others added 13 commits May 31, 2024 09:52
Chore: Dafny to Rust refactorings
- extern module as attribute
- Type arguments with type bounds (can be tested)
- Attributes handling
- Type on Select field and TupleSelect
- Name refactoring
- every In
- NoStatementBuffer
- GenFormals
- EmitNameAndActualTypeArgs (for classes)
- ParseAttributes
- GetExtractOverrideName (to be able to model Rust options)
Dafny
- StructBuild first argument to be an expression instead of a string
- Apply and ApplyType
- Type to TypeParamDecl
- Formals to Fields, NamelessFormals to NamelessFields
- Visibility to string
- Self to SelfBorrowed
- SeltMut to SelfBorrowedMut
- Box/BoxNew (for attribute annotations)
- bool
- ToOwned (used in tail recursion)
- IsImmutableConversion
- Formal.self becomes Formal.selfBorrowed
- Formal.selfMut becomes Formal.selfBorrowedMut
- AssignMember and all new variants ExtractTuple and Index
- ExprFromType
- Lambda (makes code prettier)
- Error handling
- Debug for datatypes
- No more system object, just any
- New char encoding
- int!
- Refactoring of DafatypeValue's first argument
- constant
- GenIdent refactoring
@MikaelMayer MikaelMayer added the run-deep-tests Tells CI to run all tests label Jun 6, 2024
@MikaelMayer MikaelMayer added run-integration-tests Forces running the CI for integration tests even if the deep tests fail and removed run-deep-tests Tells CI to run all tests labels Jun 6, 2024
datatype Primitive = Int | Real | String | Bool | Char

datatype NewtypeRange =
| U8 | I8 | U16 | I16 | U32 | I32 | U64 | I64 | U128 | I128 | BigInt
| NoRange

datatype Attribute = Attribute(name: string, args: seq<string>)

datatype DatatypeType = DatatypeType(path: seq<Ident>, attributes: seq<Attribute>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Side note: we should eventually give this a better name

Copy link
Member Author

Choose a reason for hiding this comment

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

Any suggestion? DataType? ResolvedDatatype ?

@@ -509,15 +600,17 @@ module RAST
PrecedenceAssociativity(110, RightToLeft)
case _ => PrecedenceAssociativity(0, RequiresParentheses)
}
case Lambda(_, _, _) => PrecedenceAssociativity(300, LeftToRight)
case _ => UnknownPrecedence()
}

ghost function Height(): nat {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could turn ToString() into a big lexicographic induction

@MikaelMayer MikaelMayer merged commit 0860638 into master Jun 22, 2024
21 checks passed
@MikaelMayer MikaelMayer deleted the chore-rust-refactorings branch June 22, 2024 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-integration-tests Forces running the CI for integration tests even if the deep tests fail
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants