diff options
author | Danil Yarantsev <tiberiumk12@gmail.com> | 2020-06-24 23:32:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-24 22:32:01 +0200 |
commit | 80952cadaab41ab198a22be5f245eb2ea678ddfa (patch) | |
tree | 891e7bf664c682f5232ec3676003d6a678550325 /compiler | |
parent | 3e5743d6f72d9953eb97e54c11149c8b77c1062d (diff) | |
download | Nim-80952cadaab41ab198a22be5f245eb2ea678ddfa.tar.gz |
Reject casts to builtin typeclasses (#14788)
* Closes #14231, closes #14452 * Merge test to tcast.nim
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 6f267b4eb..a9d45615e 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -191,6 +191,8 @@ proc isCastable(conf: ConfigRef; dst, src: PType): bool = return false if skipTypes(src, abstractInst-{tyTypeDesc}).kind == tyTypeDesc: return false + if skipTypes(dst, abstractInst).kind == tyBuiltInTypeClass: + return false if conf.selectedGC in {gcArc, gcOrc}: let d = skipTypes(dst, abstractInst) let s = skipTypes(src, abstractInst) |