mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-25 16:53:59 +00:00
changed type() to typeof() in docs and error messages (#14084)
This commit is contained in:
@@ -83,7 +83,7 @@ proc toJsKey*[T: SomeFloat](text: cstring, t: type T): T {.importcpp: "parseFloa
|
||||
|
||||
type
|
||||
JsKey* = concept a, type T
|
||||
cstring.toJsKey(T) is type(a)
|
||||
cstring.toJsKey(T) is T
|
||||
|
||||
JsObject* = ref object of JsRoot
|
||||
## Dynamically typed wrapper around a JavaScript object.
|
||||
|
||||
@@ -48,7 +48,7 @@ proc genericHead*(t: typedesc): typedesc {.magic: "TypeTrait".}
|
||||
## .. code-block:: nim
|
||||
## type
|
||||
## Functor[A] = concept f
|
||||
## type MatchedGenericType = genericHead(f.type)
|
||||
## type MatchedGenericType = genericHead(typeof(f))
|
||||
## # `f` will be a value of a type such as `Option[T]`
|
||||
## # `MatchedGenericType` will become the `Option` type
|
||||
|
||||
|
||||
@@ -45,9 +45,9 @@ proc `$`*(t: typedesc): string {.magic: "TypeTrait".}
|
||||
## `typetraits module <typetraits.html>`_.
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## doAssert $(type(42)) == "int"
|
||||
## doAssert $(type("Foo")) == "string"
|
||||
## static: doAssert $(type(@['A', 'B'])) == "seq[char]"
|
||||
## doAssert $(typeof(42)) == "int"
|
||||
## doAssert $(typeof("Foo")) == "string"
|
||||
## static: doAssert $(typeof(@['A', 'B'])) == "seq[char]"
|
||||
|
||||
when defined(nimHasIsNamedTuple):
|
||||
proc isNamedTuple(T: typedesc): bool {.magic: "TypeTrait".}
|
||||
|
||||
Reference in New Issue
Block a user