mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-31 10:53:40 +00:00
Compare commits
3 Commits
v2.0.0
...
pr_refc_co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c4a5421b5 | ||
|
|
ebb931f9f4 | ||
|
|
273d5ddf17 |
@@ -154,3 +154,4 @@ proc initDefines*(symbols: StringTableRef) =
|
||||
defineSymbol("nimHasGenericDefine")
|
||||
defineSymbol("nimHasDefineAliases")
|
||||
defineSymbol("nimHasWarnBareExcept")
|
||||
defineSymbol("nimHasWarnCopyHookForRefc")
|
||||
|
||||
@@ -88,6 +88,7 @@ type
|
||||
warnUnnamedBreak = "UnnamedBreak",
|
||||
warnStmtListLambda = "StmtListLambda",
|
||||
warnBareExcept = "BareExcept",
|
||||
warnCopyHookForRefc = "CopyHookForRefc",
|
||||
warnImplicitDefaultValue = "ImplicitDefaultValue",
|
||||
warnUser = "User",
|
||||
# hints
|
||||
@@ -190,6 +191,7 @@ const
|
||||
warnUnnamedBreak: "Using an unnamed break in a block is deprecated; Use a named block with a named break instead",
|
||||
warnStmtListLambda: "statement list expression assumed to be anonymous proc; this is deprecated, use `do (): ...` or `proc () = ...` instead",
|
||||
warnBareExcept: "$1",
|
||||
warnCopyHookForRefc: "Overriding `=copy` hook is not reliable for refc",
|
||||
warnImplicitDefaultValue: "$1",
|
||||
warnUser: "$1",
|
||||
hintSuccess: "operation successful: $#",
|
||||
|
||||
@@ -46,3 +46,7 @@ define:useStdoutAsStdmsg
|
||||
@if nimHasWarnBareExcept:
|
||||
warningAserror[BareExcept]:on
|
||||
@end
|
||||
|
||||
@if nimHasWarnCopyHookForRefc:
|
||||
warningAserror[CopyHookForRefc]:on
|
||||
@end
|
||||
|
||||
@@ -1886,6 +1886,8 @@ proc semOverride(c: PContext, s: PSym, n: PNode) =
|
||||
incl(s.flags, sfOverriden)
|
||||
if name == "=":
|
||||
message(c.config, n.info, warnDeprecated, "Overriding `=` hook is deprecated; Override `=copy` hook instead")
|
||||
elif c.config.selectedGC == gcRefc and name == "=copy":
|
||||
message(c.config, n.info, warnCopyHookForRefc)
|
||||
let t = s.typ
|
||||
if t.len == 3 and t[0] == nil and t[1].kind == tyVar:
|
||||
var obj = t[1][0]
|
||||
|
||||
Reference in New Issue
Block a user