-
Notifications
You must be signed in to change notification settings - Fork 254
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
Conversation
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
…ng/dafny into chore-rust-refactorings
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>) |
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.
Side note: we should eventually give this a better name
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.
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 { |
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.
Could turn ToString()
into a big lexicographic induction
NoStatementBuffer
to convertGenFormals
EmitNameAndActualTypeArgs
(for classes)ParseAttributes
GetExtractOverrideName
(to be able to model Rust options) DafnyStructBuild
first argument to be an expression instead of a stringApply
split intoApply
for expressions andApplyType
for type argumentsType
toTypeParamDecl
so that we can support boundsFormals
toFields
, andNamelessFormals
toNamelessFields
Visibility
has its own datatypeSelf
toSelfBorrowed
SeltMut
toSelfBorrowedMut
Box
/BoxNew
(for attribute annotations)bool
ToOwned
(used in tail recursion)IsImmutableConversion
Formal.self
becomesFormal.selfBorrowed
Formal.selfMut
becomesFormal.selfBorrowedMut
AssignMember
and all new variantsExtractTuple
andIndex
ExprFromType
to be able to simulate macros like expressionsLambda
(makes code prettier)Debug
trait for datatypesstd::any::Any
int!
macroconstant
GenIdent
refactoringHow 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.