-
Notifications
You must be signed in to change notification settings - Fork 22
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
Anonymous types cause problems with Immutability #694
Comments
This comes up when checking arguments to a function with a void Foo<[Immtuable]T>( T t ) { /* ... */ }
// ...
var t = new { y = 3 };
Foo( t ); Properties of anonymous types are read only, so in principle the caller here can assume the good invariants when calling It gets "tricky" because you can do nesting like this: new {
x = new {
y = new {
z = 3
}
}
} Implementing this wouldn't touch |
Just FYI, I moved this from bug to enhancement because its not a bug in the sense that our analyzer is doing something wrong. There are two ways to understand our analyzers behaviour:
("good"/"bad" are wrt the assumptions we get to make in our code when we use We want to be sound modulo some agreed upon exceptions (like we assume no reflection shenanigans, we trust the Audited attributes, etc.). Any places we are unsound are bugs. We would like to be as complete as possible but we are willing to make trade-offs here. In a broad sense we have no hope of being complete, so we want to be "complete enough" to get on with our lives/allow developers to write code naturally. Being more complete is mostly an "enhancement". I only care about the labelling because we do have a couple of soundness bugs :) |
The text was updated successfully, but these errors were encountered: