Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Fable.Transforms/Babel/Fable2Babel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ module Reflection =
| Replacements.Util.BclDateTimeOffset
| Replacements.Util.BclDateOnly
| Replacements.Util.BclTimeOnly
| Replacements.Util.BclRune
| Replacements.Util.BclTimer -> genericEntity fullName [||]
| Replacements.Util.BclHashSet gen
| Replacements.Util.FSharpSet gen ->
Expand Down Expand Up @@ -774,6 +775,7 @@ module Annotation =
makeFableLibImportTypeAnnotation com ctx [] "TimeOnlyTemporal" "PlainTime"
else
NumberTypeAnnotation
| Replacements.Util.BclRune -> NumberTypeAnnotation
| Replacements.Util.BclTimer -> makeFableLibImportTypeAnnotation com ctx [] "Timer" "Timer"
| Replacements.Util.BclHashSet key -> makeFableLibImportTypeAnnotation com ctx [ key ] "Util" "ISet"
| Replacements.Util.BclDictionary(key, value) ->
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Beam/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6044,7 +6044,7 @@ let tryCall
| "System.Diagnostics.Stopwatch" -> stopwatch com ctx r t info thisArg args
| Types.nullable -> nullables com ctx r t info thisArg args
| Types.guid -> guids com ctx r t info thisArg args
| "System.Random" -> randoms com ctx r t info thisArg args
| Types.random -> randoms com ctx r t info thisArg args
| "System.Environment" ->
match info.CompiledName with
| "get_NewLine" -> makeStrConst "\n" |> Some
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Dart/Fable2Dart.fs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ module Util =

match entRef.FullName, genArgs with
| Types.enum_, _
| "System.Text.Rune", _ -> Integer
| Types.rune, _ -> Integer
// F# Quotation types are modelled dynamically by the quotation runtime,
// so map them to `dynamic` (the runtime returns plain tagged objects).
| Types.fsharpExpr, _
Expand All @@ -243,7 +243,7 @@ module Util =
| "Fable.Core.Dart.DartNullable`1", [ genArg ] -> Nullable genArg
| Types.regexGroup, _ -> Nullable String
| Types.regexMatch, _ -> makeTypeRefFromName "Match" []
| "System.Random", _ -> libTypeRef com ctx "Random" "Random" []
| Types.random, _ -> libTypeRef com ctx "Random" "Random" []
// We use `dynamic` for Exception because there is no single type that catches all errors in Dart
// (except when inherited as base class, then it's getExceptionType, see transformInheritedClass)
| Types.exception_, _ -> Dynamic // getExceptionType com ctx
Expand Down
10 changes: 5 additions & 5 deletions src/Fable.Transforms/Dart/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ let toString com (ctx: Context) r (args: Expr list) =
match head.Type with
| String -> head
| Char -> charToString head
| DeclaredType({ FullName = "System.Text.Rune" }, _) -> charToString head
| DeclaredType({ FullName = Types.rune }, _) -> charToString head
// | Builtin BclGuid when tail.IsEmpty -> head
// | Builtin (BclGuid|BclTimeSpan|BclTimeOnly|BclDateOnly as bt) ->
// Helper.LibCall(com, coreModFor bt, "toString", String, args)
Expand Down Expand Up @@ -3966,7 +3966,7 @@ let private replacedModules =
"System.Runtime.ExceptionServices.ExceptionDispatchInfo", exceptionDispatchInfo
Types.char, chars
Types.string, strings
"System.Text.Rune", runes
Types.rune, runes
"Microsoft.FSharp.Core.StringModule", stringModule
"System.FormattableString", formattableString
"System.Runtime.CompilerServices.FormattableStringFactory", formattableString
Expand Down Expand Up @@ -4051,10 +4051,10 @@ let private replacedModules =
Types.dateOnly, dateOnly
Types.timeOnly, timeOnly
Types.timespan, timeSpans
"System.Timers.Timer", timers
Types.timer, timers
"System.Environment", systemEnv
"System.Globalization.CultureInfo", globalization
"System.Random", random
Types.random, random
"System.Threading.CancellationToken", cancels
"System.Threading.CancellationTokenSource", cancels
"System.Threading.CancellationTokenRegistration", disposables
Expand Down Expand Up @@ -4230,7 +4230,7 @@ let tryType typ =
| BclDateTimeOffset -> Some(Types.datetimeOffset, dates, [])
| BclDateOnly -> Some(Types.dateOnly, dateOnly, [])
| BclTimeOnly -> Some(Types.timeOnly, timeOnly, [])
| BclTimer -> Some("System.Timers.Timer", timers, [])
| BclTimer -> Some(Types.timer, timers, [])
| BclTimeSpan -> Some(Types.timespan, timeSpans, [])
| BclHashSet genArg -> Some(Types.hashset, hashSets, [ genArg ])
| BclDictionary(key, value) -> Some(Types.dictionary, dictionaries, [ key; value ])
Expand Down
6 changes: 3 additions & 3 deletions src/Fable.Transforms/Python/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4218,14 +4218,14 @@ let private replacedModules =
Types.dateOnly, dateOnly
Types.timeOnly, timeOnly
Types.timespan, timeSpans
"System.Timers.Timer", timers
Types.timer, timers
"System.Environment", systemEnv
"System.Globalization.CultureInfo", globalization
"System.IO.File", files
"System.IO.Directory", directories
"System.IO.Path", paths
"System.IO.TextWriter", textWriter
"System.Random", random
Types.random, random
"System.Threading.CancellationToken", cancels
"System.Threading.CancellationTokenSource", cancels
"System.Threading.Monitor", monitor
Expand Down Expand Up @@ -4386,7 +4386,7 @@ let tryType typ =
| BclTimeSpan -> Some(Types.timespan, timeSpans, [])
| BclDateTime -> Some(Types.datetime, dates, [])
| BclDateTimeOffset -> Some(Types.datetimeOffset, dates, [])
| BclTimer -> Some("System.Timers.Timer", timers, [])
| BclTimer -> Some(Types.timer, timers, [])
| BclHashSet genArg -> Some(Types.hashset, hashSets, [ genArg ])
| BclDictionary(key, value) -> Some(Types.dictionary, dictionaries, [ key; value ])
| BclKeyValuePair(key, value) -> Some(Types.keyValuePair, keyValuePairs, [ key; value ])
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Replacements.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ let (|BuiltinDefinition|_|) =
| Types.dateOnly -> ValueSome BclDateOnly
| Types.timeOnly -> ValueSome BclTimeOnly
| Types.rune -> ValueSome BclRune
| "System.Timers.Timer" -> ValueSome BclTimer
| Types.timer -> ValueSome BclTimer
| Types.fsharpSet -> ValueSome(FSharpSet(Any))
| Types.fsharpMap -> ValueSome(FSharpMap(Any, Any))
| Types.hashset -> ValueSome(BclHashSet(Any))
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4784,14 +4784,14 @@ let private replacedModules =
Types.dateOnly, dateOnly
Types.timeOnly, timeOnly
Types.timespan, timeSpans
"System.Timers.Timer", timers
Types.timer, timers
"System.IO.File", files
"System.IO.Directory", directories
"System.IO.Path", paths
"System.IO.TextWriter", textWriter
"System.Environment", systemEnv
"System.Globalization.CultureInfo", globalization
"System.Random", random
Types.random, random
"System.Threading.CancellationToken", cancels
"System.Threading.CancellationTokenSource", cancels
"System.Threading.Monitor", monitor
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Rust/Fable2Rust.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ module TypeInfo =
mkEmitTy value genArgs
| ent when ent.IsInterface -> transformInterfaceType com ctx entRef genArgs
| ent when ent.IsAbstractClass -> transformAbstractClassType com ctx entRef genArgs
| _ when entRef.FullName = "System.Random" ->
| _ when entRef.FullName = Types.random ->
let entName = getLibraryImportName com ctx "Random" "Random"
let genArgsOpt = transformGenArgs com ctx genArgs
makeFullNamePathTy entName genArgsOpt
Expand Down
6 changes: 3 additions & 3 deletions src/Fable.Transforms/Rust/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3509,12 +3509,12 @@ let private replacedModules =
Types.timeOnly, timeOnly
Types.rune, runes
Types.timespan, timeSpans
"System.Timers.Timer", timers
Types.timer, timers
"System.Environment", systemEnv
"System.IO.File", files
"System.IO.Path", paths
Types.cultureInfo, globalization
"System.Random", random
Types.random, random
"System.Threading.CancellationToken", cancels
"System.Threading.CancellationTokenSource", cancels
"System.Threading.Monitor", monitor
Expand Down Expand Up @@ -3674,7 +3674,7 @@ let tryType typ =
| BclDateOnly -> Some(Types.dateOnly, dateOnly, [])
| BclTimeOnly -> Some(Types.timeOnly, timeOnly, [])
| BclRune -> Some(Types.rune, runes, [])
| BclTimer -> Some("System.Timers.Timer", timers, [])
| BclTimer -> Some(Types.timer, timers, [])
| BclTimeSpan -> Some(Types.timespan, timeSpans, [])
| BclHashSet genArg -> Some(Types.hashset, hashSets, [ genArg ])
| BclDictionary(key, value) -> Some(Types.dictionary, dictionaries, [ key; value ])
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/print_no_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const STDERR: i32 = 2;

#[link(name = "c")]
unsafe extern "C" {
fn write(filedes: i32, buf: *const core::ffi::c_void, nbyte: usize);
fn write(filedes: core::ffi::c_int, buf: *const core::ffi::c_void, nbyte: usize) -> isize;
}

pub fn write_to(filedes: i32, s: &str) {
Expand Down
Loading