Rename Type.isscope to isScopeClass

This commit is contained in:
Dennis Korpel 2024-07-19 20:11:34 +02:00 committed by The Dlang Bot
parent 5862629db5
commit 9c3c0433b0
7 changed files with 19 additions and 16 deletions

View file

@ -1054,7 +1054,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
} }
FuncDeclaration fd = parent.isFuncDeclaration(); FuncDeclaration fd = parent.isFuncDeclaration();
if (dsym.type.isscope() && !(dsym.storage_class & STC.nodtor)) if (dsym.type.isScopeClass() && !(dsym.storage_class & STC.nodtor))
{ {
if (dsym.storage_class & (STC.field | STC.out_ | STC.ref_ | STC.static_ | STC.manifest | STC.gshared) || !fd) if (dsym.storage_class & (STC.field | STC.out_ | STC.ref_ | STC.static_ | STC.manifest | STC.gshared) || !fd)
{ {

View file

@ -5098,7 +5098,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
return; return;
} }
else if (sc.needsCodegen() && // interpreter doesn't need this lowered else if (sc.needsCodegen() && // interpreter doesn't need this lowered
!exp.onstack && !exp.type.isscope()) // these won't use the GC !exp.onstack && !exp.type.isScopeClass()) // these won't use the GC
{ {
/* replace `new T(arguments)` with `core.lifetime._d_newclassT!T(arguments)` /* replace `new T(arguments)` with `core.lifetime._d_newclassT!T(arguments)`
* or `_d_newclassTTrace` * or `_d_newclassTTrace`

View file

@ -1836,7 +1836,7 @@ public:
virtual bool iscomplex(); virtual bool iscomplex();
virtual bool isscalar(); virtual bool isscalar();
virtual bool isunsigned(); virtual bool isunsigned();
virtual bool isscope(); virtual bool isScopeClass();
virtual bool isString(); virtual bool isString();
virtual bool isAssignable(); virtual bool isAssignable();
virtual bool isBoolean(); virtual bool isBoolean();
@ -4256,7 +4256,7 @@ public:
TypeClass* syntaxCopy() override; TypeClass* syntaxCopy() override;
ClassDeclaration* isClassHandle() override; ClassDeclaration* isClassHandle() override;
uint8_t deduceWild(Type* t, bool isRef) override; uint8_t deduceWild(Type* t, bool isRef) override;
bool isscope() override; bool isScopeClass() override;
bool isBoolean() override; bool isBoolean() override;
void accept(Visitor* v) override; void accept(Visitor* v) override;
}; };

View file

@ -677,7 +677,7 @@ extern (C++) abstract class Type : ASTNode
return false; return false;
} }
bool isscope() bool isScopeClass()
{ {
return false; return false;
} }
@ -3537,7 +3537,7 @@ extern (C++) final class TypeClass : Type
return wm; return wm;
} }
override bool isscope() override bool isScopeClass()
{ {
return sym.stack; return sym.stack;
} }

View file

@ -239,7 +239,7 @@ public:
virtual bool iscomplex(); virtual bool iscomplex();
virtual bool isscalar(); virtual bool isscalar();
virtual bool isunsigned(); virtual bool isunsigned();
virtual bool isscope(); virtual bool isScopeClass();
virtual bool isString(); virtual bool isString();
virtual bool isAssignable(); virtual bool isAssignable();
virtual bool isBoolean(); virtual bool isBoolean();
@ -748,7 +748,7 @@ public:
TypeClass *syntaxCopy() override; TypeClass *syntaxCopy() override;
ClassDeclaration *isClassHandle() override; ClassDeclaration *isClassHandle() override;
unsigned char deduceWild(Type *t, bool isRef) override; unsigned char deduceWild(Type *t, bool isRef) override;
bool isscope() override; bool isScopeClass() override;
bool isBoolean() override; bool isBoolean() override;
void accept(Visitor *v) override { v->visit(this); } void accept(Visitor *v) override { v->visit(this); }

View file

@ -1810,7 +1810,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
default: default:
break; break;
} }
if (tbn.isscope()) if (tbn.isScopeClass())
{ {
.error(loc, "cannot have array of scope `%s`", tbn.toChars()); .error(loc, "cannot have array of scope `%s`", tbn.toChars());
return error(); return error();
@ -1844,7 +1844,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
default: default:
break; break;
} }
if (tn.isscope()) if (tn.isScopeClass())
{ {
.error(loc, "cannot have array of scope `%s`", tn.toChars()); .error(loc, "cannot have array of scope `%s`", tn.toChars());
return error(); return error();
@ -2050,7 +2050,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
default: default:
break; break;
} }
if (mtype.next.isscope()) if (mtype.next.isScopeClass())
{ {
.error(loc, "cannot have array of scope `%s`", mtype.next.toChars()); .error(loc, "cannot have array of scope `%s`", mtype.next.toChars());
return error(); return error();
@ -2216,7 +2216,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
tf.next = tf.next.typeSemantic(loc, sc); tf.next = tf.next.typeSemantic(loc, sc);
sc = sc.pop(); sc = sc.pop();
errors |= tf.checkRetType(loc); errors |= tf.checkRetType(loc);
if (tf.next.isscope() && !tf.isctor) if (tf.next.isScopeClass() && !tf.isctor)
{ {
.error(loc, "functions cannot return `scope %s`", tf.next.toChars()); .error(loc, "functions cannot return `scope %s`", tf.next.toChars());
errors = true; errors = true;

View file

@ -17,14 +17,14 @@ fail_compilation/typeerrors.d(52): Error: cannot have associative array of `void
fail_compilation/typeerrors.d(54): Error: cannot have parameter of type `void` fail_compilation/typeerrors.d(54): Error: cannot have parameter of type `void`
fail_compilation/typeerrors.d(56): Error: slice `[1..5]` is out of range of [0..4] fail_compilation/typeerrors.d(56): Error: slice `[1..5]` is out of range of [0..4]
fail_compilation/typeerrors.d(57): Error: slice `[2..1]` is out of range of [0..4] fail_compilation/typeerrors.d(57): Error: slice `[2..1]` is out of range of [0..4]
fail_compilation/typeerrors.d(59): Error: variable `typeerrors.foo.globalC` globals, statics, fields, manifest constants, ref and out parameters cannot be `scope`
fail_compilation/typeerrors.d(59): Error: variable `typeerrors.foo.globalC` reference to `scope class` must be `scope`
fail_compilation/typeerrors.d(60): Error: variable `typeerrors.foo.manifestC` globals, statics, fields, manifest constants, ref and out parameters cannot be `scope`
fail_compilation/typeerrors.d(60): Error: variable `typeerrors.foo.manifestC` reference to `scope class` must be `scope`
--- ---
*/ */
template tuple(T...) { alias T tuple; } template tuple(T...) { alias T tuple; }
void bar(); void bar();
@ -55,4 +55,7 @@ void foo()
alias T2 = T[1 .. 5]; alias T2 = T[1 .. 5];
alias T3 = T[2 .. 1]; alias T3 = T[2 .. 1];
static C globalC;
enum C manifestC = new C();
} }