class Foo def main is shared s = 'aoeu' t = s to String # .warning. The given expression is already a "String" so the typecast is redundant. You can remove it. a = B() to A # no warning here because casting to a more general type is a legit way to affect type inference .compute(a) # just to use the variable to avoid a warning u = 'aoeu' to ? t = u to String # .warning. The given expression is already a "String", but nilable. You can just use "to !". u2 = u to String? # .warning. The given expression is already a "String?" so the typecast is redundant. You can remove it. assert u2 # just to use the variable to avoid a warning u = t to String? # .warning. The given expression is already a "String", but not nilable. You can just use "to ?". def compute(a as A) is shared pass class A pass class B inherits A pass