-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partial Fix of #401: Variables & Properties with generic type paramet…
…er (#412) * Fix brackets for variables with generic types Variables are now transformed into Properties: Variables were already emitted as F# Properties, but their handling was different from real Properties. Now Variables are converted into Properties in `transform.fs` and can use the same print code as real Properties. Exception: Top level variables. These are printed as `let` binding, not abstract members in an interface. * Add Generic Type Constraints for Variables and Properties * Add tests for interface (Properties instead of variables -- but same issues for function properties) * Add tests for class * Add more tests Add (more) tests for multiple parameter: Strange behaviour in F#: `abstract v: string -> string -> string` is ok, `abstract v: string -> string -> string` isn't, but required brackets Further with generyc type parameter: `abstract v: 'T -> 'T -> 'T` is ok, but (unlike with just `string`) `abstract v: ('T -> 'T -> 'T)` is not (type parameter 'T is not defined) Add tests for optional property: Again strange behaviour in F#: `abstract o: 'T option` isn't allowed, but `abstract o: 'T option with get,set` is. Most of these cases most likely don't occur in real code. In the source for this issue and its tests it's not a general `'T`, but a limitation (subset) of a string Enum * Revert: Don't handle Variable in `printType` There might be cases a Variable wasn't transformed into a property. These would now fail. To prevent this Variables are now again handled in `printType` as a fallback. Additional a log message is printed to console. * Add tests for static members
- Loading branch information
Showing
5 changed files
with
1,106 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.