@@ -3845,8 +3845,7 @@ static void validateTables(Module& module, ValidationInfo& info) {
38453845 }
38463846 }
38473847
3848- Type externref = Type (HeapType::ext, Nullable);
3849- Type funcref = Type (HeapType::func, Nullable);
3848+ auto funcref = Type (HeapType::func, Nullable);
38503849 for (auto & table : module .tables ) {
38513850 info.shouldBeTrue (table->initial <= table->max ,
38523851 " table" ,
@@ -3855,17 +3854,13 @@ static void validateTables(Module& module, ValidationInfo& info) {
38553854 table->type .isNullable (),
38563855 " table" ,
38573856 " Non-nullable reference types are not yet supported for tables" );
3858- if (!module .features .hasGC ()) {
3859- info.shouldBeTrue (table->type .isFunction () || table->type == externref,
3860- " table" ,
3861- " Only function reference types or externref are valid "
3862- " for table type (when GC is disabled)" );
3863- }
3864- if (!module .features .hasGC ()) {
3865- info.shouldBeTrue (table->type == funcref || table->type == externref,
3866- " table" ,
3867- " Only funcref and externref are valid for table type "
3868- " (when gc is disabled)" );
3857+ auto typeFeats = table->type .getFeatures ();
3858+ if (!info.shouldBeTrue (table->type == funcref ||
3859+ typeFeats <= module .features ,
3860+ " table" ,
3861+ " table type requires additional features" )) {
3862+ info.getStream (nullptr )
3863+ << getMissingFeaturesList (module , typeFeats) << ' \n ' ;
38693864 }
38703865 if (table->is64 ()) {
38713866 info.shouldBeTrue (module .features .hasMemory64 (),
0 commit comments